Removing grad tensors creation if tensor does not require grad.#3190
Closed
tudorcebere wants to merge 8 commits intoOpenMined:masterfrom
tudorcebere:master
Closed
Removing grad tensors creation if tensor does not require grad.#3190tudorcebere wants to merge 8 commits intoOpenMined:masterfrom tudorcebere:master
tudorcebere wants to merge 8 commits intoOpenMined:masterfrom
tudorcebere:master
Conversation
TTitcombe
reviewed
Mar 13, 2020
TTitcombe
suggested changes
Mar 13, 2020
Member
TTitcombe
left a comment
There was a problem hiding this comment.
Looks good. A couple of points:
- Can you add a test to confirm that we can now send a model with frozen layers
- If you add the line
Fixes #3180to the description, the issue will automatically be closed when the PR gets merged
Contributor
Author
|
Should be fine now. |
Contributor
|
@tudorcebere Looks good, but seems like this PR picked up some |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I observed that syft is creating grad tensors for all tensors, even if freezed and calling backwards on them. The grad tensors are useful with unfreezed layers only, right? The lead was from the autograd[0] documentation. If I remove the grad_tensor creation for the freezed layers and leave it None, it seems to work fine. Any advices?
This PR fixes #3180.
[0]: https://pytorch.org/docs/stable/autograd.html