-
Notifications
You must be signed in to change notification settings - Fork 327
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
Writing tests for transforms #79
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Apr 19, 2022
vmoens
added
enhancement
New feature or request
bc breaking
backward compatibility breaking change
major
major refactoring in the code base
naming
Naming convention in the code
labels
Apr 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bc breaking
backward compatibility breaking change
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
enhancement
New feature or request
major
major refactoring in the code base
naming
Naming convention in the code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduces tests for
torchrl.envs.transforms
classes.Together with this PR, we also change the logic by which envs return observations.
Before
Each
env.step
returned a tensordict with various keys. All the new observations were labelled with the prefix'next_observation'
.The envs
observation_spec
attribute could have been any type of TensorSpec.Now
We expect all
observation_spec
to be of the Composite type. This ensures that all observations are signed with their keyword.It is not expected anymore that all observations have the
'next_observation'
prefix, but each key of the Composite TensorSpec must start with'next_'
. Therefore, the signature of the env step is consistent: the observation spec points to'next_'
keys that can be found when callingstep()
.For reset, while it is still the default behaviour that the
'next_'
is removed, it can be recovered by setting theexecute_step
to False. This is used by_BatchedEnv
subclasses and by theTransformedEnv
class to make sure that all observations are marked with anext_
(which is necessary for the transforms to be applied, for instance).