Skip to content

Conversation

@ymwdalex
Copy link
Contributor

Description

Define transform_observation_spec function in _R3MNet class

  1. if del_keys is True, we delete all items in the input observation_spec
  2. We iterate the keys_out, for each output key, we generate NdUnboundedContinuousTensorSpec objects with corresponding ResNet output dimension as shape

Add test cases

One test case TestR3MNet.test_r3mnet_transform_observation_spec is added. In the test, we set up these parameters

  • models: resnet 18/34/50
  • del_keys: True or False
  • keys_in: [["next_pixels"], ["next_pixels_1", "next_pixels_2", "next_pixels_3"]]
  • keys_out: [["next_r3m_vec"], ["next_r3m_vec_1", "next_r3m_vec_2", "next_r3m_vec_3"]]

Then we compare the new observation_spec with the expected ones.

Motivation and Context

close #407

Types of changes

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of examples)

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 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 Sep 14, 2022
@ymwdalex
Copy link
Contributor Author

Hi @vmoens, I got the message for the workflow:

1 workflow awaiting approval
First-time contributors need a maintainer to approve running workflows. [Learn more.](https://docs.github.com/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks)

Could you please approve this workflow? Thanks!

@vmoens vmoens changed the title [Feature ]Add transform_observation_spec _R3MNet [Feature] Add transform_observation_spec _R3MNet Sep 14, 2022
@ymwdalex ymwdalex force-pushed the feature/issue-407-tensorspec-r3m branch from 4ff349a to 7da6421 Compare September 14, 2022 14:05
Copy link
Collaborator

@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, let's clean up the tests and land this!

@vmoens vmoens added the bug Something isn't working label Sep 15, 2022
@vmoens vmoens changed the title [Feature] Add transform_observation_spec _R3MNet [BugFix] Add transform_observation_spec _R3MNet Sep 15, 2022
Zhe Sun added 2 commits September 15, 2022 13:07
…rate transform_observation_spec tests inside TestR3M test suite; 3) fix some errors
@ymwdalex ymwdalex force-pushed the feature/issue-407-tensorspec-r3m branch from 7da6421 to ee03c05 Compare September 15, 2022 15:31
@ymwdalex
Copy link
Contributor Author

LGTM, let's clean up the tests and land this!

Thanks for your comments! I have improved the code accordingly, rebased to the latest main branch, and update the branch.

Copy link
Collaborator

@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!

@vmoens vmoens merged commit 2127e60 into pytorch:main Sep 15, 2022
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.

[Feature Request] Create a tensorspec for the R3M output

3 participants