8000 Support nn.EmbeddingBag by alexandresablayrolles · Pull Request #519 · pytorch/opacus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support nn.EmbeddingBag #519

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

Closed
wants to merge 6 commits into from
Closed

Conversation

alexandresablayrolles
Copy link
Contributor

WIP. Passing activations as a list instead of as a tensor.

@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 6, 2022
@facebook-github-bot
Copy link
Contributor

@alexandresablayrolles has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor
@ffuuugor ffuuugor left a comment

Choose a reason for hiding this comment

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

Cool, definitely make sense given that the inputs to the backward hook itself is a list of tensors.
Left one inline comment. Additionally, please take a look at the linter output. Unit test error is irrelevant as it's inherited from main, but the flake is new I think

Comment on lines +59 to +60
@register_grad_sampler(nn.EmbeddingBag)
def compute_embeddingbag_gradsampler(layer, inputs, backprops):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we maybe have a test for it, like we have for other supported layers?

@facebook-github-bot
Copy link
Contributor

@alexandresablayrolles has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@alexandresablayrolles alexandresablayrolles changed the title Pass activations as a list Support nn.EmbeddingBag Oct 31, 2022
@facebook-github-bot
Copy link
Contributor
8000

@alexandresablayrolles has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@alexandresablayrolles has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@alexandresablayrolles has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@alexandresablayrolles has updated the pull request. You must reimport the pull request before landing.

@@ -282,7 +282,7 @@ def capture_activations_hook(

if not hasattr(module, "activations"):
module.activations = []
module.activations.append(forward_input[0].detach()) # pyre-ignore
module.activations.append([t.detach() for t in forward_input]) # pyre-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be append or extend?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think append is right, as activations is a list of tuples in this case

@ffuuugor
Copy link
Contributor
ffuuugor commented Nov 3, 2022

LGTM

@facebook-github-bot
Copy link
Contributor

@alexandresablayrolles has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0