Skip to content

Removing grad tensors creation if tensor does not require grad.#3200

Merged
gmuraru merged 6 commits intomasterfrom
tudorcebere/pr-3190
Mar 16, 2020
Merged

Removing grad tensors creation if tensor does not require grad.#3200
gmuraru merged 6 commits intomasterfrom
tudorcebere/pr-3190

Conversation

@karlhigley
Copy link
Contributor

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

Revised version of #3190.

@gmuraru gmuraru merged commit eabe8f6 into master Mar 16, 2020
@gmuraru gmuraru deleted the tudorcebere/pr-3190 branch March 16, 2020 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime Error asking all parameters to have requires_grad=True

2 participants