Deal with undefined tensors in unbind backward#9995
Deal with undefined tensors in unbind backward#9995t-vi wants to merge 2 commits intopytorch:masterfrom
Conversation
When only part of the outputs of unbind are used in a backward, the gradients for the others are undefined. This sets those to zero in to_tensor_list. Fixes: pytorch#9977
|
|
||
| std::vector<Tensor> to_tensor_list(const variable_list& variables) { | ||
| return fmap(variables, [](const Variable &v) { return static_cast<Tensor>(v); } ); | ||
| IntList sizes; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
...to make the code clearer. Based on a review comment by SsnL, thank you!
|
The failure looks like that it might be related to the change. Can you see if it reproduces locally? |
|
The TestCuda.test_index? I cannot reproduce that and in fact I think that might just be the build failure du jour then (a randomly chosen adjacent build had that, too). Could you ask for a rebuild, please? If that fails, I'll take another look. |
|
@pytorchbot retest this please |
|
Thanks! Seems to have worked. :) |
facebook-github-bot
left a comment
There was a problem hiding this comment.
soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: When only part of the outputs of unbind are used in a backward, the gradients for the others are undefined. This sets those to zero in to_tensor_list. Fixes: pytorch#9977 Pull Request resolved: pytorch#9995 Differential Revision: D9239610 Pulled By: soumith fbshipit-source-id: eb8d1b3f2b4e615449f9d856e10b946910df9147
Summary: When only part of the outputs of unbind are used in a backward, the gradients for the others are undefined. This sets those to zero in to_tensor_list. Fixes: pytorch#9977 Pull Request resolved: pytorch#9995 Differential Revision: D9239610 Pulled By: soumith fbshipit-source-id: eb8d1b3f2b4e615449f9d856e10b946910df9147
When only part of the outputs of unbind are used in a backward,
the gradients for the others are undefined. This sets those
to zero in to_tensor_list.
Fixes: #9977