Python ValueError:维度必须相等,但对于';为64和4;马特穆尔';(op:';MatMul';)具有以下输入形状:[?,64],[4,]
我犯了个错误Python ValueError:维度必须相等,但对于';为64和4;马特穆尔';(op:';MatMul';)具有以下输入形状:[?,64],[4,],python,tensorflow,keras,Python,Tensorflow,Keras,我犯了个错误 ValueError: Dimensions must be equal, but are 64 and 4 for 'MatMul' (op: 'MatMul') with input shapes: [?,64], [4,?]. 我写代码 from keras import backend as K print(input_encoded_m) print(question_encoded) match = K.dot(input_encoded_m, question_e
ValueError: Dimensions must be equal, but are 64 and 4 for 'MatMul' (op: 'MatMul') with input shapes: [?,64], [4,?].
我写代码
from keras import backend as K
print(input_encoded_m)
print(question_encoded)
match = K.dot(input_encoded_m, question_encoded)
打印(输入编码)显示张量(“cond\u 3/Merge:0”,shape=(?,68,64),dtype=float32)
,打印(问题编码)显示张量(“cond\u 5/Merge:0”,shape=(?,4,64),dtype=float32)
。我认为点法不适合计算矩阵的不同秩,所以我重写了
from keras import backend as K
match = K.get_value(input_encoded_m * question_encoded)
但出现这种错误:
ValueError: Dimensions must be equal, but are 68 and 4 for 'mul' (op: 'Mul') with input shapes: [?,68,64], [?,4,64]
我如何计算
输入编码的和问题编码的?有什么问题吗?我不确定实际输入数量是哪个维度,但第一个维度必须相同
但例如,您需要有形状:
(68,64,4)
和(68,4,64)
或
(64,68,4)
和(64,4,68)
或
(4,68,64)
和(4,64,68)
等
但是您有输入的数量68
和4
,这些需要匹配
您应该检查中给出的示例