Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions deepxde/optimizers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ def set_LBFGS_options(
LBFGS_options["maxfun"] = maxfun if maxfun is not None else int(maxiter * 1.25)
LBFGS_options["maxls"] = maxls

# Backend-dependent options
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify my understanding: set_hvd_opt_options sets the LFBGS options along with doing the backend-specific operations, but in reality set_LFBGS_options should handle this itself, causing the bug that when you call set_LGBGS_options by itself, it wont update iter_per_step and fun_per_step.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_LBFGS_options is expected to update all L-BFGS-related parameters, including iter_per_step and fun_per_step used in the Paddle and PyTorch backends. However, the current implementation does not update them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. This looks good.

if backend_name in ["pytorch", "paddle"]:
# number of iterations per optimization call
LBFGS_options["iter_per_step"] = min(1000, LBFGS_options["maxiter"])
LBFGS_options["fun_per_step"] = (
LBFGS_options["maxfun"]
* LBFGS_options["iter_per_step"]
// LBFGS_options["maxiter"]
)


def set_NNCG_options(
lr=1,
Expand Down Expand Up @@ -149,14 +159,3 @@ def set_hvd_opt_options(
set_NNCG_options()
if hvd is not None:
set_hvd_opt_options()


# Backend-dependent options
if backend_name in ["pytorch", "paddle"]:
# number of iterations per optimization call
LBFGS_options["iter_per_step"] = min(1000, LBFGS_options["maxiter"])
LBFGS_options["fun_per_step"] = (
LBFGS_options["maxfun"]
* LBFGS_options["iter_per_step"]
// LBFGS_options["maxiter"]
)
Loading