ValueError:密集层的输入0与该层不兼容:其等级未定义,但是该层需要一个已定义的等级 [英] ValueError: Input 0 of layer dense is incompatible with the layer: its rank is undefined, but the layer requires a defined rank
问题描述
在> https://www.tensorflow.org/tutorials/images/上尝试该示例时使用tf '2.0.0-alpha0'
的本地计算机上的hub_with_keras (下载,pip
-下载hub '0.4.0-dev'
并删除!pip...
行,安装tf 2,删除enable_v2_behavior
,运行文件),则失败,
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:密集层的输入0与该层不兼容:其等级未定义,但是该层需要一个已定义的等级.
ValueError: Input 0 of layer dense is incompatible with the layer: its rank is undefined, but the layer requires a defined rank.
它在Google colab上运行良好.为什么会这样,如何解决?
It runs fine on Google colab though. Why is this and how can it be fixed?
推荐答案
如@arnoegw在评论中所建议,此问题已在tf-nightly-2.0-preview
中修复.因此,直到它投入生产之前,只需使用
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
这篇关于ValueError:密集层的输入0与该层不兼容:其等级未定义,但是该层需要一个已定义的等级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!