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

Loopifying conditional kwarg processing in _optimize_acqf_batch #1923

Closed
wants to merge 1 commit into from

Conversation

SebastianAment
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot added CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported labels Jul 10, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47297929

Copy link
Member

@esantorella esantorella left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 313 to 314
if getattr(opt_inputs, constraint_name) is not None:
gen_kwargs[constraint_name] = getattr(opt_inputs, constraint_name)
Copy link
Member

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...

Suggested change
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

Copy link
Contributor Author

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 :)

SebastianAment added a commit to SebastianAment/botorch that referenced this pull request Jul 10, 2023
…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
@facebook-github-bot
Copy link
Contributor

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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47297929

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 1d077c9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants