我有斧numpy的數組:故障定義numpy的數組作爲tensorflow變量
[0, 6, 3513, 7, 155, 794, 25, 223, 8, 32, 20, 202, 5025, 350, 91, 6, 66, 207, 5, 2]
我想將它定義爲一個tensorflow變量如下:
tf.Variable(x)
而且我得到以下錯誤:
TypeError: Expected binary or unicode string, got [0, 6, 3513, 7, 155, 794, 25, 223, 8, 32, 20, 202, 5025, 350, 91, 6, 66, 207, 5, 2]
到底是什麼?
我沒有回答你的問題。只需確認導入numpy爲np; 將tensorflow導入爲tf; x = np.array([0,6,3513,7,155,794,25,223,8,32,20,202,5025,350,91,6,66,207,5,2]) ; tf.Variable(x)在這裏工作(正如你猜測它應該) – tagoma