keras-team/keras

softmax sliently generate a wrong output when the mask has an incompatible shape

Opened this issue · 1 comments

As shown in this colab, the mask can arbitrarily change the shape of output.
Although the document requires that the mask has the same shape with input, no check exists actually.
In my project, the shape of input is hard to compute and this potential incompatibility can affect the result and is hard to debug since softmax now silently generates an wrong output.
Currently the output is:
1715915144162
You can identify the shape changed by mask(line 2 and line 3 of output), which is different from the correct shape computed by compute_output_shape() (line4).

Hi @AGFACBNNR ,

Thanks for reporting this issue. I acknowledge the missing check for same shape for input and mask. Attached gist for same.

Will propose a fix for same. Thanks!