-
Notifications
You must be signed in to change notification settings - Fork 404
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
Loopifying conditional kwarg processing in _optimize_acqf_batch
#1923
Conversation
This pull request was exported from Phabricator. Differential Revision: D47297929 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
botorch/optim/optimize.py
Outdated
if getattr(opt_inputs, constraint_name) is not None: | ||
gen_kwargs[constraint_name] = getattr(opt_inputs, constraint_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a bad idea since it doesn't work for Python < 3.8, but...
if getattr(opt_inputs, constraint_name) is not None: | |
gen_kwargs[constraint_name] = getattr(opt_inputs, constraint_name) | |
if (constraint := getattr(opt_inputs, constraint_name)) is not None: | |
gen_kwargs[constraint_name] = constraint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! The main botorch readme lists Python >= 3.8 as a requirement, should be fine :)
…torch#1923) Summary: Pull Request resolved: pytorch#1923 Small code simplification, pattern could be reused elsewhere for `kwarg` processing, particularly where a number of fields have to be check. Reviewed By: esantorella Differential Revision: D47297929 fbshipit-source-id: 6cf9aa8ecb1248512d298ee792e4804dc60bcd3f
d773740
to
348392b
Compare
This pull request was exported from Phabricator. Differential Revision: D47297929 |
…torch#1923) Summary: Pull Request resolved: pytorch#1923 Small code simplification, pattern could be reused elsewhere for `kwarg` processing, particularly where a number of fields have to be check. Reviewed By: esantorella Differential Revision: D47297929 fbshipit-source-id: 27df69a4aa87fb3f8d8c1f0a42b7d8e4bdd3c8c2
This pull request was exported from Phabricator. Differential Revision: D47297929 |
348392b
to
be57b36
Compare
This pull request has been merged in 1d077c9. |
Summary: Small code simplification, pattern could be reused elsewhere for
kwarg
processing, particularly where a number of fields have to be check.Differential Revision: D47297929