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

Deal with more Gym cases #1327

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Deal with more Gym cases #1327

wants to merge 4 commits into from

Conversation

teytaud
Copy link
Contributor

@teytaud teytaud commented Dec 21, 2021

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and Context / Related issue

How Has This Been Tested (if it applies)

Checklist

  • The documentation is up-to-date with the changes I made.
  • I have read the CONTRIBUTING document and completed the CLA (see CLA).
  • All tests passed, and additional code has been covered with new tests.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Dec 21, 2021
@teytaud teytaud changed the title deal with more Gym cases Deal with more Gym cases Dec 21, 2021
Comment on lines 818 to 822
if type(a) == tuple:
try:
a = tuple(int(_a + 0.5) for _a in a)
except: # oh my FSM! A tuple of nd-array probably.
a = tuple(np.asarray(_a+.5, dtype=int) for _a in a)
Copy link
Contributor

Choose a reason for hiding this comment

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

does it have to be tuples ? np.round(a) would be much simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It depends on the gym problem, not on nevergrad.
The point is to deal with (at least some) nested structures which are not ndarray.

Copy link
Contributor

Choose a reason for hiding this comment

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

usually I would expect it's simpler to convert everything to array, and then update the type if need be

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are complicated types in Gym actually. You can have a dict of tuple of ndarray or stuff like that.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants