Fixing Tensorflow and Numpy NotImplementedError Cannot convert a symbolic Tensor

Tensorflow and Numpy NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array is an error which occurs when numpy is not compatible with Tensorflow or even python.

I will explain why this error takes place and how to fix it, while also trying to add other solutions that could solve the error.

Exploring Tensorflow and Numpy NotImplementedError Cannot convert a symbolic Tensor

This is an error which occurs when numpy is not compatible with Tensorflow or even python.

Please double check so you can avoid mixing between different errors. The error message should look like the error message bellow.

Fixing Tensorflow and Numpy NotImplementedError Cannot convert a symbolic Tensor

Bellow we will take care of the error using multiple possible solutions according to your needs.

Solution 1 : Downgrade numpy using conda or pip or Downgrade Python instead

We have established the fact that the error occurs when numpy is not compatible with Tensorflow or with python.

There are many ways to solve the issue, if you want to keep your version of numpy you can just downgrade python

Check out this link which provides a great guide to downgrade python https://www.delftstack.com/howto/python/downgrade

Another option is to downgrade your numpy version using this command

Fixing Tensorflow and Numpy NotImplementedError Cannot convert a symbolic Tensor

Where v.v.v is the desired version, preferably the previous version.

You can also use conda to downgrade numpy, just like this

Fixing Tensorflow and Numpy NotImplementedError Cannot convert a symbolic Tensor

v.v.v is still the desired version, this is all for this method. If this does not work, please try the method bellow.

Solution 2 : install numpy 1.19.5 and take care of compatibility issues

The error will also happen if you use numpy version >1.19.5 with tensorflow 2.5

If you have tensorflow 2.5 you can only work with numpy version 1.19.5 and python 3.9

You can install numpy 1.19.5 like this

Fixing Tensorflow and Numpy NotImplementedError Cannot convert a symbolic Tensor

This is the end of the article, thanks for reading our post and good luck with the scripts to come.

Summing-up : 

I hope you got rid of the error : Tensorflow and Numpy NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array

If you want to support us consider donating to our Kofi account using the red button on top of this page.

Keep coding, keep learning Python and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/