在TF1训练中使用的NumPy数组-在TF2中,Keras的准确性低得多

时间:2019-10-05 06:13:38

标签: python-3.x tensorflow tensorflow-datasets tensorflow2.0 tf.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}}]]

1 个答案:

答案 0 :(得分:1)

在创建.repeat()的过程中附加tf.data.Dataset解决了我的错误。就像duysqubix在雄辩的解决方案中建议的那样:

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