0
我正嘗試使用Tensorflow工具創建神經網絡。Tensorflow中的InvalidArgumentError
sizeOfRow = len(data[0])
x = tensorFlow.placeholder("float", shape=[None, sizeOfRow])
y = tensorFlow.placeholder("float")
def neuralNetworkTrain(x):
prediction = neuralNetworkModel(x)
# using softmax function, normalize values to range(0,1)
cost = tensorFlow.reduce_mean(tensorFlow.nn.softmax_cross_entropy_with_logits(prediction, y))
這是從網上 部分我有錯誤:
InvalidArgumentError (see above for traceback): logits and labels must be same size: logits_size=[500,2] labels_size=[1,500]
[[Node: SoftmaxCrossEntropyWithLogits = SoftmaxCrossEntropyWithLogits[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](Reshape, Reshape_1)]]
有人知道什麼`錯了嗎?
編輯: 也是我從這段代碼有:
for temp in range(int(len(data)/batchSize)):
ex, ey = takeNextBatch(i) # takes 500 examples
i += 1
# TO-DO : fix bug here
temp, cos = sess.run([optimizer, cost], feed_dict= {x:ex, y:ey})
此錯誤 類型錯誤:unhashable類型: '名單'