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

[Feature] Add make_tensordict() function #522

Merged
merged 4 commits into from
Oct 7, 2022

Conversation

sicong-huang
Copy link
Contributor

@sicong-huang sicong-huang commented Oct 5, 2022

Description

Implement new function make_tensordict() that can automatically create tensordict from keyword arguments. When batch_size is unspecified, it assumes maximum possible batch_size based on the input source dict.

Motivation and Context

Closes #518

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

  • New feature (non-breaking change which adds core functionality)
  • Documentation (update in the documentation)

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.

@facebook-github-bot 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 Oct 5, 2022
@vmoens vmoens added the enhancement New feature or request label Oct 6, 2022
@vmoens vmoens changed the title Add make_tensordict() function [Feature] Add make_tensordict() function Oct 6, 2022
Copy link
Contributor

@vmoens vmoens left a comment

Choose a reason for hiding this comment

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

Brilliant! Just a couple of things and we'll be good to go

test/test_tensordict.py Outdated Show resolved Hide resolved
torchrl/data/tensordict/tensordict.py Outdated Show resolved Hide resolved
torchrl/data/tensordict/tensordict.py Outdated Show resolved Hide resolved
test/test_tensordict.py Outdated Show resolved Hide resolved
torchrl/data/tensordict/tensordict.py Show resolved Hide resolved
@sicong-huang sicong-huang marked this pull request as ready for review October 6, 2022 21:59
Copy link
Contributor

@vmoens vmoens left a comment

Choose a reason for hiding this comment

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

LGTM thanks for this!

@vmoens vmoens merged commit db446af into pytorch:main Oct 7, 2022
@sicong-huang sicong-huang deleted the make-tensordict-fn branch October 17, 2022 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Automatic tensordict creator
3 participants