我正在使用keras构建一个密集模型来实现暹罗分类器,并且有一个操作数无法与形状一起广播(16,5)(6,5)(16,5)错误:

Traceback (most recent call last):
  File "D:/prog/COQA/project/classify_question_with_siamese_drei.py", line 
122, in <module>
    classifier.model.fit([question1, question2, is_same], y=None, 
batch_size=16, epochs=1)
  File "C:\Users\Joker\AppData\Local\Programs\Python\Python36\lib\site- 
packages\keras\engine\training.py", line 1657, in fit
    validation_steps=validation_steps)
  File "C:\Users\Joker\AppData\Local\Programs\Python\Python36\lib\site- 
packages\keras\engine\training.py", line 1219, in _fit_loop
    callbacks.on_batch_end(batch_index, batch_logs)
  File "C:\Users\Joker\AppData\Local\Programs\Python\Python36\lib\site- 
packages\keras\callbacks.py", line 109, in on_batch_end
     callback.on_batch_end(batch, logs)
  File "C:\Users\Joker\AppData\Local\Programs\Python\Python36\lib\site- 
packages\keras\callbacks.py", line 216, in on_batch_end
     self.totals[k] += v * batch_size
ValueError: operands could not be broadcast together with shapes (16,5) 
(6,5) (16,5)

keras回调on_batch_end似乎有问题,我有训练数据大小2566和batch_size 16,这意味着(6,5)是数据的最后一部分 . 当我进一步探索错误并在callbacks.py中发现广播问题时:

self.totals[k] += v * batch_size

这里正常的v是[16,5]数组,当错误发生时,它变为[6,5],我想知道这里有什么问题 . 此外,模型取3个输入,x1 x2和标签,标注在输入中的注意,因为损失函数将使用它 .