tensorflow ValueError: Dimensions must be equal

在使用tf.matmul进行矩阵相乘的时候报了这么个错

。。。。
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
    debug_python_shape_fn, require_shape_fn)
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 676, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Dimensions must be equal, but are 8 and 21 for 'MatMul' (op: 'MatMul') with input shapes: [21,8], [21,0].].

按道理来说21×8的矩阵乘以21行的列向量是可以乘的,乘完的结果的是21一行的列向量,最后发现tf.matmul函数只能进行矩阵间的乘法操作

你可能感兴趣的:(tensorflow)