fix bug in online_softmax when all loaded values in a warp are -inf#64
fix bug in online_softmax when all loaded values in a warp are -inf#64LitLeo wants to merge 3 commits intoDao-AILab:mainfrom
Conversation
|
I think it's better to have the check: The subtracting |
if max_x == -Float32.inf:
max_x = Float32(0.0)is OK, but I noticed that row_reduce has the same issue. if const_expr(not is_even_N):
# utils.fill_oob(tXsX, tXpX, -tXsX.element_type.inf)
utils.fill_oob(tXsX, tXpX, -BFloat16(2**15)) |
|
I prefer changing max-cur. For the case where the input is entirely -inf (not out of bounds) we still want output to be zero. |
Remove handling for max_x being -inf to avoid NaN in exp_x.
Done. |
|
Thanks, could you add a test case where the whole vector is -inf? |
A test case where the entire vector is -inf is meaningless, as the loss of this vector would be NaN. This bug is triggered when N=150000, so I've added a case with N to the test_cross_entropy. |
if max_x=-inf, exp_x=nan, which causes error result.