I am getting crazy trying to solve this problem
NotImplementedError: Cannot convert a symbolic Tensor (LSTM-4/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
I started with a fresh installation of Anaconda on my Windows 10 PC:
C:\WINDOWS\system32>conda info
active environment : base
active env location : C:\Anaconda3
shell level : 1
user config file : C:\Users\Administrator\.condarc
populated config files :
conda version : 4.12.0
conda-build version : 3.21.4
python version : 3.8.8.final.0
virtual packages : __win=0=0
__archspec=1=x86_64
base environment : C:\Anaconda3 (writable)
conda av data dir : C:\Anaconda3\etc\conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Anaconda3\pkgs
C:\Users\Administrator\.conda\pkgs
C:\Users\Administrator\AppData\Local\conda\conda\pkgs
envs directories : C:\Anaconda3\envs
C:\Users\Administrator\.conda\envs
C:\Users\Administrator\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.12.0 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
administrator : True
netrc file : None
offline mode : False
Then I installed the tensorflow package with
conda install tensorflow
Then I tried to create a model following this example, in particular lines
model = Sequential()
model.add(LSTM(50, input_shape=(train_X.shape[1], train_X.shape[2])))
model.add(Dense(1))
model.compile(loss='mae', optimizer='adam')
Which generates the error (the actual line generating the error is the addition of the LSTM layer).
I then tried to upgrade to TF 2.6.0, however, giving the following update command
conda install -c conda-forge tensorflow=2.6.0
leads to a nightmare of conflicts that cannot be resolved (several hours later the conflict output is past 8 klines and overflows my shell buffer).
I have two questions:
- How can I resolve the problem, meaning I need python 3.8 and tensorflow supporting LSTM networks? Does my plan to try upgrading to 2.6.0 make sense?
- How it is possible that a stable release from Anaconda does ship with a broken tensorflow package? Could be the example being outdated? In this case can somebody suggest the right syntax?
Sincerely,