Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.6K
Visualizações
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 Respostas
Responde à pergunta

0

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

over 4 years ago · Hanz Gallego Relatório

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 Relatório

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 Relatório

0

If you are using anaconda:

conda install numpy=1.19

over 4 years ago · Hanz Gallego Relatório

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 Relatório

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 Relatório

0

I solved with numpy downgrade to 1.18.5

pip install -U numpy==1.18.5
over 4 years ago · Hanz Gallego Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda