-
Notifications
You must be signed in to change notification settings - Fork 417
[Feature] Adding support for initialising TensorDicts from nested dicts #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
Conversation
|
It seems like the tests are currently failing due to the new version of gym, and it's currently being handled at #403 |
|
PTAL @vmoens |
vmoens
left a comment
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.
Almost there: It seems everything is coded and the CI is happy!
Can we test the setting
tensordict[:, :2] = {"a": torch.randn(3, 4, 5), ...}One way to test that would be
sub_td = tensordict[:, :2].to_tensordict() # clone the data to a new tensordict
sub_td.zero_()
sub_dict = sub_td.to_dict()
tensordict[:, :2] = sub_dict
# check that all values in tensordict[:, :2] are zero| ) | ||
| raise err | ||
| else: | ||
| indexed_bs = _getitem_batch_size(self.batch_size, index) |
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.
I've put the TensorDict casting over here, because the batch size wouldn't be computed correctly for broadcasting
| - future | ||
| - cloudpickle | ||
| - gym | ||
| - gym==0.25.1 |
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.
we should be able to remove this now
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.
The main branch currently has it fixed too, should I remove it here?
|
Note about the PR:
|
We definitely need some hardcore cleanup in the calls from |
Description
As described in #390, this PR addresses initialisation of TensorDicts from nested Python dictionaries.
Namely, it includes three new functionalities:
batch sizeanddevice:returns
batch sizeanddevice:returns
returns
Motivation and Context
The motivation and context for the change is described in #390
Types of changes
What types of changes does your code introduce? Remove all that do not apply:
Checklist
Go over all the following points, and put an
xin all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!