2016-12-27 82 views
1

我试图使用Tensorflow首次Tensorflow AttributeError的:“数据集”对象有没有属性“形象”

这里是我的代码,我从一个教程了:

import numpy as np 
import matplotlib.pyplot as plt 
import tensorflow as tf 
learn = tf.contrib.learn 
tf.logging.set_verbosity(tf.logging.ERROR) 

mnist = learn.datasets.load_dataset('mnist') 
data = mnist.train.image //THIS IS WHERE THE ERROR OCCURS 
labels = np.asarray(mnist.train.labels, dtype=np.int32) 
test_data = mnist.test.images 
test_labels = np.asarray(mnist.test.labels, dtype = np.int32) 

我得到这个错误在上面指定的行AttributeError: 'DataSet' object has no attribute 'image'

我该如何解决这个问题?

回答

2

MNIST DataSet对象(实施here)没有image属性,但它确实有an images property。下面的变化应该解决的事情:

data = mnist.train.images 
+0

......我无法相信我错过了,哈哈 –

相关问题