NotImplementedError: Cannot convert a symbolic Tensor to a numpy array报错与解决

  • Post author:
  • Post category:其他




NotImplementedError: Cannot convert a symbolic Tensor报错与解决

环境:

TensorFlow2.3.0

报错信息:

NotImplementedError: Cannot convert a symbolic Tensor (sequential/simple_rnn/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

解决方法:

numpy版本过高,conda安装指定版本的numpy 1.19.2即可解决问题

# 方法一
conda search numpy
conda install numpy=1.19.2 -c conda-forge

# 方法二
pip install numpy==1.19.2