Debug Tensorflow: TypeError: Cannot convert a symbolic Keras input/output to a numpy array.

问题

'Cannot convert a symbolic Keras input/output to a numpy array. ’
TypeError: Cannot convert a symbolic Keras input/output to a numpy array. This error may indicate that you’re trying to pass a symbolic value to a NumPy call, which is not supported. Or, you may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model.

解决

  • 检查numpy tensorflow版本是否符合要求
  • 我这里是import的问题
from tensorflow.python.keras.layers import Input, Lambda, Dense,

修改为

from tensorflow.keras.layers import Input, Lambda, Dense,

我的问题解决

你可能感兴趣的:(python,人工智能,docker)