Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLM gradients #161

Merged
merged 23 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
lower case for dlm_epsilon
  • Loading branch information
rtqichen committed Apr 22, 2022
commit 5f8b7e1038cc858c9ab70ab2109a57ccbad28a76
2 changes: 1 addition & 1 deletion examples/backward_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def fit_x(data_x_np):
"track_best_solution": True,
"verbose": False,
"backward_mode": th.BackwardMode.DLM,
"DLM_epsilon": 1e-2,
"dlm_epsilon": 1e-2,
},
)
start = time.time()
Expand Down
4 changes: 2 additions & 2 deletions theseus/theseus_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ def forward(
)
optimizer_kwargs = optimizer_kwargs or {}
backward_mode = optimizer_kwargs.get("backward_mode", None)
DLM_epsilon = optimizer_kwargs.get("DLM_epsilon", 1e-2)
dlm_epsilon = optimizer_kwargs.get("dlm_epsilon", 1e-2)
if backward_mode == BackwardMode.DLM:
# TODO: instantiate self.bwd_objective here.
names = set(self.objective.aux_vars.keys()).intersection(input_data.keys())
rtqichen marked this conversation as resolved.
Show resolved Hide resolved
tensors = [input_data[n] for n in names]
*vars, info = TheseusLayerDLMForward.apply(
self.objective, self.optimizer, optimizer_kwargs, input_data, DLM_epsilon, *tensors
self.objective, self.optimizer, optimizer_kwargs, input_data, dlm_epsilon, *tensors
)
else:
vars, info = _forward(self.objective, self.optimizer, optimizer_kwargs, input_data)
Expand Down