codekansas/keras-language-modeling

Output shape of the similarity merge layer is still incorrect

guxd opened this issue · 1 comments

guxd commented

I use the latest version and check the similarity part of the model, i.e.,
qa_model = merge([question_output, answer_output], mode=similarity, output_shape=lambda x: x[:-1],name='similarity')
When I invoke qa_model.summary(), here is the screen output:
insuranceqa similarity

capture

The last layer (similarity) should have an output shape of (None, 1) but is (None, 200). I use the default 'cos' mode of Keras, it is (None,1). Also, the program doesn't work. It has nan loss.

I fixed this just now. I think the output shape should just always be (None, 1). The thing is, I don't think it made a difference. I think the nan loss could be coming from somewhere else? Not sure. Let me know if this fixed it.