Commit 7957bd6
committed
Skip parameter updates when gradients contain NaN or Inf
- Add check before Optimisers.update to detect NaN/Inf in gradients
- Skip update but still increment iteration counter when detected
- Add warning message (maxlog=10) to inform users
- Fixes issue where NaN gradients corrupt all subsequent updates
Addresses: https://discourse.julialang.org/t/how-to-ignore-minibatches-with-nan-gradients-optimizing-a-hybrid-lux-model-using-optimization-jl/1326151 parent 846e6c1 commit 7957bd6
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| |||
0 commit comments