InvalidArgumentError: Matrix size-incompatible: In[0]: [32,4], In[1]: [32,4] [[{{node MatMul}} = M

错误:tensorflow.python.framework.errors_impl.InvalidArgumentError: Matrix size-incompatible: In[0]: [32,4], In[1]: [32,4]
     [[{{node MatMul}} = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](sequential_1/dense_2/BiasAdd, one_hot)]]

tensorflow.python.framework.errors_impl.InvalidArgumentError: Matrix size-incompatible: In[0]: [32,4], In[1]: [32,4]
     [[{{node MatMul}} = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](sequential_1/dense_2/BiasAdd, one_hot)]]

错误原因:不应该使用tf.matmul,应该使用tf.multiply

注意:tf.matmul是矩阵的乘法,tf.multiply是矩阵元素之间的乘法

 

 

你可能感兴趣的:(Tensorflow)