Skip to content

Commit

Permalink
Detach fval in torch_minimize to avoid memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelbue committed Sep 11, 2024
1 parent 4d49bf7 commit d974542
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion botorch/optim/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def torch_minimize(
)

# TODO: Update stopping_criterion API to return a message.
if stopping_criterion and stopping_criterion(fval):
if stopping_criterion and stopping_criterion(fval.detach()):
result.status = OptimizationStatus.STOPPED
result.message = "`torch_minimize` stopped due to `stopping_criterion`."

Expand Down

0 comments on commit d974542

Please sign in to comment.