tensorflow AttributeError:'module'对象没有属性'data'

时间:2017-11-06 18:20:42

标签: python tensorflow tensorflow-datasets tfrecord

我尝试Importing Data

我尝试加载我创建的tfrecords数据集。但我总是得到这个错误。

以下是代码:

import tensorflow as tf

EPOCHS = 10
BATCH_SIZE = 32

train_filename = ['/home/viktor/PycharmProjects/Datasets/101_ObjectCategories_tfrecords/rain.tfrecords']
dataset = tf.data.TFRecordDataset(train_filename)
#dataset = dataset.map(...)
dataset = dataset.repeat(EPOCHS)
dataset = dataset.batch(BATCH_SIZE)

iterator = dataset.make_one_shot_iterator()

next_images, next_labels = iterator.get_next()

loss = tf.add(1,next_labels)

with tf.Session() as sess:
    tf.global_variables_initializer().run()
    for step in xrange(10):
        curr_loss= sess.run(loss)

但是tf.data ......应该存在吗? 谢谢

1 个答案:

答案 0 :(得分:1)

您可能正在运行旧版本的tensorflow。尝试将其更新为1.4,其中包含数据API。