ValueError: Input 0 of layer dense is incompatible with the layer: its rank is undefined, but the layer requires a defined rank

断了今生、忘了曾经 提交于 2019-12-11 14:51:32

问题


When trying the example at https://www.tensorflow.org/tutorials/images/hub_with_keras at a local computer with tf '2.0.0-alpha0' (download, pip-download hub '0.4.0-dev' and remove !pip... lines, install tf 2, remove enable_v2_behavior , run file), it failed with

ValueError: Input 0 of layer dense is incompatible with the layer: its rank is undefined, but the layer requires a defined rank.

It runs fine on Google colab though. Why is this and how can it be fixed?


回答1:


As proposed by @arnoegw in the comments, this is fixed in tf-nightly-2.0-preview. So until it lands in production, just use

pip install tf-nightly-2.0-preview


来源:https://stackoverflow.com/questions/55682557/valueerror-input-0-of-layer-dense-is-incompatible-with-the-layer-its-rank-is-u

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