问题类型
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.
原因
Keras 和tensorflow的版本匹配问题
解决方案
1.升级自己的tensorflow版本
pip install --upgrade tensorflow
升级至2.**版本中自带Keras ,这时你可以选择不安装Keras
2.打开下面链接查看自己tensorflow版本对应的keras版本
https://docs.floydhub.com/guides/environments/
找到适合自己的版本后进行安装,相应代码为:
pip install keras==版本号(如2.2.4)
pip install keras==2.2.4
命令执行完重新导入keras
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)