Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.6K
Vistas
NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array. T

tensorflow version 2.3.1 numpy version 1.20

below the code

# define model
model = Sequential()
model.add(LSTM(50, activation='relu', input_shape=(n_steps, n_features)))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')

we got

NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported

it seems to me a crazy error!

over 4 years ago · Hanz Gallego
7 Respuestas
Responde la pregunta

0

I had the same problem, solved it by downgrading python from 3.8 to 3.6

over 4 years ago · Hanz Gallego Denunciar

0

Similar issue, with

  • tensorflow 2.3.0
  • numpy 1.20.3

on Windows 7.

Solved by modifying tensorflow/python/framework/ops.py, replacing

  def __array__(self):
    raise NotImplementedError(

at line #845~846 with

  def __array__(self):
    raise TypeError(

.

over 4 years ago · Hanz Gallego Denunciar

0

Tensorflow 2.5 update:

tensorflow and tensorflow-gpu 2.5 packages still includes numpy-1.19.5 as a dependency.

The error referenced in this post will be reproduced if tensorflow 2.5 installation is mixed with numpy>1.19.5

tensorflow-2.5, numpy-1.19.5 are compatible with python-3.9

over 4 years ago · Hanz Gallego Denunciar

0

If you are using anaconda:

conda install numpy=1.19

over 4 years ago · Hanz Gallego Denunciar

0

I faced this issue with M1 chip. Here is the how I fixed:

conda create create --name tf
conda activate tf
conda install numpy ~=1.18.5
pip install tensorflow-macos

and voila you are ready to go !

over 4 years ago · Hanz Gallego Denunciar

0

I had the same issue with tensorflow 2.5.0 and numpy 1.21.2. There were suggestions here to make changes in array_ops.py file but this didn't work for me. Another answer in the same page with following steps worked.

pip uninstall tensorflow
pip install tensorflow
pip uninstall numpy
pip install numpy

Basically these steps don't downgrade numpy but either upgrades or keeps it at the same level. Above steps upgraded tensorflow 2.7.0 and numpy 1.21.4 and my code ran without any issues.

over 4 years ago · Hanz Gallego Denunciar

0

I solved with numpy downgrade to 1.18.5

pip install -U numpy==1.18.5
over 4 years ago · Hanz Gallego Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda