Skip to content

Conversation

benoitdescamps
Copy link
Contributor

@benoitdescamps benoitdescamps commented Jul 19, 2022

Description

Fixes issue #258

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

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 Jul 19, 2022
@vmoens vmoens added the bug Something isn't working label Jul 19, 2022
@vmoens vmoens linked an issue Jul 19, 2022 that may be closed by this pull request
@vmoens
Copy link
Collaborator

vmoens commented Jul 20, 2022

Thanks for picking this up @benoitdescamps
I'm looking into the failing test.
There is a bunch of stuff that needs to be fixed for this PR to be mergeable, I'm taking care of it. Bear with me, I'll do a PR on your branch as soon as I'm done with it!

@vmoens
Copy link
Collaborator

vmoens commented Jul 20, 2022

Thanks for picking this up @benoitdescamps I'm looking into the failing test. There is a bunch of stuff that needs to be fixed for this PR to be mergeable, I'm taking care of it. Bear with me, I'll do a PR on your branch as soon as I'm done with it!

you can check the PR here benoitdescamps#1

@benoitdescamps benoitdescamps changed the title T126316008 TorchRL: Support list-based boolean masks for TensorDict Jul 20, 2022
@vmoens vmoens changed the title TorchRL: Support list-based boolean masks for TensorDict [BugFix] Support list-based boolean masks for TensorDict Jul 20, 2022
benoitdescamps and others added 3 commits July 20, 2022 15:29
BugFix: test setting values using mask, fix various bugs in masking tensordicts
@vmoens
Copy link
Collaborator

vmoens commented Jul 21, 2022

We have device issues in the tests, do you think you can handle it @benoitdescamps ?

@benoitdescamps
Copy link
Contributor Author

We have device issues in the tests, do you think you can handle it @benoitdescamps ?

yes, I will have a go at it

"key2": torch.randn(4, 5, 10, device=device),
}
mask = torch.zeros(4, 5, dtype=torch.bool, device=device).bernoulli_()
mask_list = mask.numpy().tolist()
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be moved to cpu too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@benoitdescamps benoitdescamps force-pushed the T126316008 branch 2 times, most recently from 395cb7c to 1c27607 Compare July 21, 2022 14:04
@benoitdescamps benoitdescamps requested a review from vmoens July 21, 2022 15:23
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 for this feature! Also helped to uncover a couple of bugs, which is great!

@vmoens vmoens merged commit 5c74ab7 into pytorch:main Jul 21, 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.

[Bug] Support list-based boolean masks for TensorDict
3 participants