NotImplementedError:无法将符号张量(lstm_2/strided_slice:0)转换为numpy数组。吨
张量流版本 2.3.1 numpy 版本 1.20
代码下方
# 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')
我们有
NotImplementedError:无法将符号张量 (lstm_2/strided_slice:0) 转换为 numpy 数组。此错误可能表明您正在尝试将张量传递给 NumPy 调用,但不受支持
在我看来这是一个疯狂的错误!
回答
我用 numpy 降级到 1.18.5 解决了
pip install -U numpy==1.18.5
- I was just looking at the 1.20 release notes. There are a number of low level changes (which I didn't fully understand), so I'm not surprised that there compatibility issues with `tensorflow`. I don't know who has to fix what.
- Numpy version 1.19.5 resolves the issues as well.
- I just did as well 🙂
THE END
二维码