【问题标题】:AttributeError: module 'tensorflow._api.v2.train' has no attribute 'string_input_producer'AttributeError:模块“tensorflow._api.v2.train”没有属性“string_input_producer”
【发布时间】:2021-03-19 15:02:41
【问题描述】:

我尝试运行https://github.com/4Catalyzer/cyclegan.git 我有类似的错误

AttributeError: 模块 'tensorflow._api.v2.train' 没有属性 'string_input_producer'

我使用 python 3.8.5 和 tensorflow 2.4.1

【问题讨论】:

    标签: python-3.x tensorflow


    【解决方案1】:

    tf.compat.v1.train.string_input_producer 已被弃用。它将在未来的版本中删除。更新说明:基于队列的输入管道已替换为tf.data

    使用tf.data.Dataset.from_tensor_slices(string_tensor)

    shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)。如果 shuffle=False,则省略 .shuffle(...)

    【讨论】:

      猜你喜欢
      • 2021-10-08
      • 1970-01-01
      • 1970-01-01
      • 2021-09-24
      • 2020-10-03
      • 2021-03-25
      • 2020-07-05
      • 2020-07-29
      相关资源
      最近更新 更多