我的(Keras)模型有两个不同形状的输入。Keras 网站上的示例说它应该可以工作。
我将输入定义如下:
model1 = Model(inputs=[uii, vji], outputs=[decoded,decoded2, prod])
model1.summary()
Model: "model_10"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_49 (InputLayer) [(None, 1682)] 0
__________________________________________________________________________________________________
input_51 (InputLayer) [(None, 943)] 0
__________________________________________________________________________________________________
但是在拟合模型时:
model1.fit([matrix, matrix.T], [matrix, matrix.T,matrix.reshape(-1)])
它产生以下错误:
/tensorflow-2.1.0/python3.6/tensorflow_core/python/keras/engine/training_utils.py in check_array_lengths(inputs, targets, weights) 733 raise ValueError('All input arrays (x) should have '734'相同的数字样本数。得到数组形状:' + --> 735 str([x.shape for x in inputs])) 736 if len(set_y) > 1: 737 raise ValueError('All target arrays (y) should have '
ValueError:所有输入数组 (x) 应具有相同数量的样本。得到数组形状:[(943, 1682), (1682, 943)]
有什么解决方案可以解决这种错误?谢谢