【问题标题】:Numpy arrays used in training in TF1--Keras have much lower accuracy in TF2TF1 训练中使用的 Numpy 数组——Keras 在 TF2 中的准确率要低得多
【发布时间】:2020-02-03 08:24:28
【问题描述】:

我在 keras 中有一个表现良好的神经网络。现在随着 Tensorflow 2 的弃用,我不得不重写模型。现在它给了我更差的准确性指标。

我怀疑 tf2 希望你使用他们的数据结构来训练模型,他们举了一个例子来说明如何从 Numpy 转到 tf.data.Dataset here

所以我做到了:

train_dataset = tf.data.Dataset.from_tensor_slices((X_train_deleted_nans, y_train_no_nans))
train_dataset = train_dataset.shuffle(SHUFFLE_CONST).batch(BATCH_SIZE)

一旦训练开始,我就会收到以下警告错误:

2019-10-04 23:47:56.691434: W tensorflow/core/common_runtime/base_collective_executor.cc:216] BaseCollectiveExecutor::StartAbort Out of range: End of sequence
     [[{{node IteratorGetNext}}]]

【问题讨论】:

标签: python-3.x tensorflow tensorflow-datasets tensorflow2.0 tf.keras


【解决方案1】:

.repeat() 添加到我的tf.data.Dataset 的创建中解决了我的错误。就像 duysqubix 在此处发布的雄辩解决方案中所建议的那样:

https://github.com/tensorflow/tensorflow/issues/32817#issuecomment-539200561

【讨论】:

    猜你喜欢
    • 2020-02-11
    • 2020-10-17
    • 2018-09-18
    • 1970-01-01
    • 2023-03-17
    • 2020-04-07
    • 2021-10-13
    • 2019-02-14
    • 2018-08-03
    相关资源
    最近更新 更多