我收到一个错误,
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)
打印(input_encoded_m(显示Tensor("cond_3/Merge:0", shape=(?, 68, 64), dtype=float32)
,打印(question_encoded(显示Tensor("cond_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]
如何计算input_encoded_m
和question_encoded
?怎么了?
我不确定您的实际输入数量是哪个维度,但第一个维度需要相同。
但例如,您需要有形状:
(68, 64, 4)
和(68, 4, 64)
或
(64, 68, 4)
和(64, 4, 68)
或
(4, 68, 64)
和(4, 64, 68)
等。
但是你有很多输入68
和4
,这些需要匹配。
您应该查看文档中此处给出的示例。