在 Keras 中实现多输入模型,每个模型都有不同的样本大小(每个样本大小不同)

Implementing a multi-input model in Keras, each with a different sample sizes each (different batch sizes each)

我目前正在尝试在 Keras 中实现多输入模型。输入由多个批次组成,每个批次都包含不同的样本,但我得到了 'different samples'-error。我的实现如下所示:

模型站点如下所示:

for s in range(NUM_STREAMS):
    inp.append(Input(shape=(16,8)))
...

发生错误的站点:

history = model.train_on_batch(
                x=[x for x in X_batch],
                y=[y for y in y_batch]
            )

我得到的错误是:

ValueError: All input arrays (x) should have the same number of
samples. Got array shapes: [(6, 16, 8), (7, 16, 8), (6, 16, 8), (6, 16, 8)]

抽象模型架构如下:

仅供参考,当遇到类似的问题时,我在 tensorflow 中重写了我的模型,因为它们的计算图不受限于保持批量大小维度不变。