predict with Keras fails due to faulty environment setup

北城以北 提交于 2019-12-01 22:45:49

It turned out the code wasn't the problem, but there was something wrong with my software. After the following steps, the above code runs without errors or warnings:

  1. uninstall anaconda
  2. install anaconda
  3. create new environment
  4. install required packages into that environment (keras, tensorflow, spyder...)
  5. run code in that environment

I pasted your code into https://colab.research.google.com and it didn't give me an error. (python2)

I did however get a warning about int to float conversion.

I would try to specify the test_input dtype explicitly as in:

test_input = np.zeros((1,inDim), dtype=float)

Since that seems to be the error message that is being output.

I uninstalled and installed the Anaconda Navigator again and it got fixed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!