Commit 04e267f
committed
Fix softmax masking for illegal moves in inference
Multiplying logits by a binary 0/1 mask sets illegal move logits to 0,
but softmax(0) is not zero — it still contributes probability mass.
Use masked_fill with -inf so softmax correctly assigns exactly 0
probability to illegal moves.
Fixes the issue raised in PR #9.
https://claude.ai/code/session_01ELpknikQ4vWB4q8hWhxoVG1 parent 16c1383 commit 04e267f
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
0 commit comments