【问题标题】:AttributeError: module 'tensorflow' has no attribute 'contrib' -- @tf.contrib.eager.defunAttributeError: 模块 \'tensorflow\' 没有属性 \'contrib\' -- @tf.contrib.eager.defun
【发布时间】:2022-11-09 01:55:05
【问题描述】:

我在连接 tensorflow 时遇到问题,在我的脚本中有解码器 @tf.contrib.eager.defun。运行后只给出错误(AttributeError:模块'tensorflow'没有属性'contrib')。请帮我。我的版本张量 = 2.8.0

我更改了一些 tensorflow 命令,但又出现了这个问题

【问题讨论】:

  • tf.contrib 已从 TF 2.0 开始移出 TF,看看这些 tf 2.0 release notes。更多详情可以参考here。谢谢!

标签: python tensorflow


【解决方案1】:

@tf.contrib.eager.defun 似乎对其修饰函数进行了某种预编译以提高性能,并且是一种 TF 1.0 方法。我找不到它在 TF 2.0 中的移动位置,所以我通过降级 TF 或删除装饰器(后者会减慢执行速度)让它工作。

【讨论】:

    猜你喜欢
    • 2021-06-23
    • 1970-01-01
    • 1970-01-01
    • 2020-08-17
    • 2020-03-17
    • 1970-01-01
    • 2019-09-16
    • 1970-01-01
    • 2021-02-17
    相关资源
    最近更新 更多