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

[BugFix] ToTensorImage unsqueeze would not update the observation spec #1161

Merged
merged 1 commit into from
May 17, 2023
Merged

Conversation

hyerra
Copy link
Contributor

@hyerra hyerra commented May 16, 2023

Description

If you use ToTensorImage with the unsqueeze parameter set, the observations are unsqueezed correctly. However, the observation spec isn't updated. This PR fixes that issue.

Motivation and Context

This is necessary for methods like fake_tensordict() where the generated tensordict depends on the observation spec. This change makes sure the observation dict is updated accordingly so methods like fake_tensordict() work properly.

close #1160

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • 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
Copy link

Hi @hyerra!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 May 16, 2023
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 a mil for spotting this and fixing it

@vmoens vmoens merged commit 555e156 into pytorch:main May 17, 2023
@vmoens vmoens changed the title Fix bug where ToTensorImage unsqueeze would not update the observation spec [BugFix] ToTensorImage unsqueeze would not update the observation spec May 17, 2023
@vmoens vmoens added the bug Something isn't working label May 17, 2023
@hyerra
Copy link
Contributor Author

hyerra commented May 17, 2023

Glad I could help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] ToTensorImage doesn't update the observation spec properly if unsqueeze=True
3 participants