Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ValueError:维度必须相等,但对于';为64和4;马特穆尔';(op:';MatMul';)具有以下输入形状:[?,64],[4,]_Python_Tensorflow_Keras - Fatal编程技术网

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
,这些需要匹配

您应该检查中给出的示例