2017-07-18 75 views
0

我試圖養活一個佔位符下面的語句時:類型錯誤餵養tensorflow佔位

image = tf.placeholder(tf.int32,shape = (256,256)) 
image.eval(feed_dict={image, (image_)}) 

其中image_是:

array([[ 5, 12, 8, ..., 21, 2, 11], 
     [ 5, 11, 13, ..., 9, 12, 4], 
     [ 7, 2, 13, ..., 7, 9, 6], 
     ..., 
     [ 1, 1, 6, ..., 8, 2, 4], 
     [ 0, 2, 6, ..., 3, 6, 7], 
     [ 4, 1, 4, ..., 9, 0, 5]], dtype=uint32) 

而且我得到的錯誤是:類型錯誤:unhashable類型: 'numpy.ndarray'。任何人有任何想法?

順便說一句,我想加載.mat文件張成圖像。我有更好的選擇嗎?

謝謝。

+0

你可能意味着使用':'(冒號)而不是','(逗號)?在你的例子中,你將'set'作爲'feed_dict'關鍵字參數,而不是'dict'。 –

+0

太好了。非常感謝! –

回答

1

feed_dict應該是一個字典,所以你需要更改線路

image.eval(feed_dict={image, (image_)}) 

image.eval(feed_dict={image:image_}) 
+0

非常感謝。我想知道是否可以只用feed.dict構建圖形,然後用sess運行圖形?我想這是要求我參加會議。 –

+0

您可以將佔位符定義爲構建圖形的一部分。你不需要會話。但是,您必須在會話中運行line.eval(feed_dict = {image:image_})。 –

相關問題