【问题标题】:Tensorflow 2.3.0 - Warning: get_next_as_optional (from tensorflow.python.data.ops.iterator_ops) is deprecated and will be removed in a future versionTensorflow 2.3.0 - 警告:get_next_as_optional(来自 tensorflow.python.data.ops.iterator_ops)已弃用,将在未来版本中删除
【发布时间】:2020-07-29 16:33:28
【问题描述】:

我刚刚更新到 TF-2.3。在使用tf.data.Dataset.from_tensor_slices 作为数据源的模型中,我收到以下警告:

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/multi_device_iterator_ops.py:601: get_next_as_optional (from tensorflow.python.data.ops.iterator_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.data.Iterator.get_next_as_optional()` instead.

我没有在文档中找到有关如何使用更新方法的说明。

train_dataset = tf.data.Dataset.from_tensor_slices(
    (
        {"input_1": x1_train, 
         "input_2": x2_train}, 
        {"output": y_train},
    )
)

train_batches = train_dataset.batch(GLOBAL_BATCH_SIZE)

培训:

history = model.fit(
    x = train_batches,
    epochs=30,
    verbose = 1,
)

提前致谢。

【问题讨论】:

  • 我认为问题是来自 TF 的内部调用,在官方在线指南的示例中也出现了此警告。

标签: python tensorflow keras tensorflow2.0


【解决方案1】:

您可以在 2.3 中忽略此警告。这是为了让您知道您正在使用的库之一正在调用 TensorFlow 计划在未来版本中删除的方法。对于您当前的使用情况,它可以正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-07
    • 1970-01-01
    • 1970-01-01
    • 2019-04-28
    • 2018-11-29
    • 2021-02-23
    • 1970-01-01
    • 2018-12-21
    相关资源
    最近更新 更多