2016-12-27 78 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

......我無法相信我錯過了,哈哈 –

相關問題