【发布时间】:2019-09-04 15:44:30
【问题描述】:
我有这个代码:
(train_images, _), (test_images, _) = tf.keras.datasets.mnist.load_data()
train_dataset = tf.data.Dataset.from_tensor_slices(train_images).shuffle(TRAIN_BUF).batch(BATCH_SIZE)
test_dataset = tf.data.Dataset.from_tensor_slices(test_images).shuffle(TRAIN_BUF).batch(BATCH_SIZE)
print(train_dataset, type(train_dataset), test_dataset, type(test_dataset))
我想将这两个BatchDataset 变量转换为numpy arrays,我可以轻松做到吗?我正在使用TF 2.0,但我刚刚找到了将tf.data 与TF 1.0 一起转换的代码
【问题讨论】:
标签: python tensorflow casting