【问题标题】:ValueError: Input 0 of layer dense is incompatible with the layer: its rank is undefined, but the layer requires a defined rankValueError: Input 0 of layer dense is in compatible with the layer: its rank is undefined, but the layer requires a defined rank
【发布时间】:2019-09-05 01:04:09
【问题描述】:

在使用 tf '2.0.0-alpha0' 的本地计算机上尝试 https://www.tensorflow.org/tutorials/images/hub_with_keras 的示例时(下载,pip-下载 hub '0.4.0-dev' 并删除 !pip... 行,安装 tf 2,删除 enable_v2_behavior ,运行file),它失败了

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

不过,它在 Google colab 上运行良好。为什么会这样?如何解决?

【问题讨论】:

  • tf-nightly-2.0-preview替换tensorflow=2.0.0-alpha0有帮助吗?
  • @arnoegw:是的!非常感谢
  • @arnoegw:欢迎发布答案(为了节省时间,您可以简单地复制粘贴我的“这是固定的......”部分)。

标签: python tensorflow google-colaboratory tensorflow-hub


【解决方案1】:

正如@arnoegw 在 cmets 中提出的,这已在tf-nightly-2.0-preview 中得到修复。所以在它投入生产之前,只需使用

pip install tf-nightly-2.0-preview

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-06
    • 1970-01-01
    • 2021-06-29
    • 2022-09-24
    • 2022-01-03
    • 2021-05-05
    • 2022-07-15
    相关资源
    最近更新 更多