2017-09-20 161 views
0

我正在運行以下代碼,最後一行會引發錯誤。Tensorflow matmul尺寸錯誤

weights = tf.Variable(
tf.truncated_normal([DATA_POINTS, hidden1_units], 
         stddev=1.0/math.sqrt(float(DATA_POINTS))), 
    name='weights') 
biases = tf.Variable(tf.zeros([hidden1_units]), 
        name='biases') 
hidden1 = tf.nn.relu(tf.matmul(images, weights) + biases) 

錯誤:

InvalidArgumentError (see above for traceback): Matrix size-incompatible: In[0]: [96,336], In[1]: [366,128] 

我在爲什麼我收到此錯誤困惑。不應該通過[366,128]矩陣工作乘以[96,366]矩陣?

謝謝

+2

它是336而不是366,請注意中間數字 – user3080953

回答

0

明白了。這是我的代碼中的一個錯字(用366代替336)。