You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix LBFGS/BFGS callback receiving Dual numbers instead of scalar loss values
Fixes#1073
When using LBFGS or BFGS with bounds, Optim.jl wraps the optimizer in Fminbox,
which may use ForwardDiff internally for gradient computation. This resulted in
the callback receiving ForwardDiff.Dual numbers instead of scalar loss values,
causing incorrect (sometimes negative) values to be reported.
Changes:
- Use SciMLBase.value() to extract scalar values from potentially Dual-valued traces
- Updated all three _cb callback functions to use SciMLBase.value()
- Added comprehensive test case verifying callbacks receive correct scalar non-negative values
- No new dependencies required (SciMLBase already provides the functionality)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments