Skip to content

Commit

Permalink
Bux fix
Browse files Browse the repository at this point in the history
According to the [scipy docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html), the method ‘trust-constr’ requires different callback signature. Hence, supplying 'minimize_constr' with a callback raised an error before this bug fix.
  • Loading branch information
dudifrid authored Oct 21, 2022
1 parent 71d6ab9 commit c8bcc34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchmin/minimize_constr.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ def minimize_constr(
# handle callbacks
if callback is not None:
callback_ = callback
callback = lambda x: callback_(
torch.tensor(x, dtype=x0.dtype, device=x0.device).view_as(x0))
callback = lambda x, state: callback_(
torch.tensor(x, dtype=x0.dtype, device=x0.device).view_as(x0), state)

# handle bounds
if bounds is not None:
Expand Down

0 comments on commit c8bcc34

Please sign in to comment.