Fix gradgrad issues with BatchNorm and Advanced Indexing (v.0.2.0)#2268
Merged
soumith merged 3 commits intopytorch:v0.2.0from Aug 2, 2017
Merged
Fix gradgrad issues with BatchNorm and Advanced Indexing (v.0.2.0)#2268soumith merged 3 commits intopytorch:v0.2.0from
soumith merged 3 commits intopytorch:v0.2.0from
Conversation
…t needed. These could cause a problem with double backwards because they were std::move'd in Backward.
… indexing case that fails check.
Contributor
Author
|
@killeent for simplicity I fixed the advanced indexing case in python because it's easier, but it should probably be fixed in C++ in case we ever call advanced_indexing_select in other places. Let's do that in the master version; I'd like to keep this v.0.2.0 version as light as possible. |
This was referenced Aug 1, 2017
soumith
approved these changes
Aug 2, 2017
soumith
reviewed
Aug 2, 2017
| std::move(grad_bias)); | ||
| return wrap_outputs(all_inputs, std::move(outputs), [&](FunctionFlags f) { | ||
| return std::make_shared<BatchNormBackwardBackward>( | ||
| f, *this, std::move(save_mean), std::move(save_std), |
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.
soumith
reviewed
Aug 2, 2017
| jacobian_x[:, i].zero_() | ||
| else: | ||
| jacobian_x[:, i] = d_x.to_dense() if d_x.is_sparse else d_x | ||
| for jacobian_c in (jacobian, jacobian_reentrant): |
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.
IvanYashchuk
pushed a commit
to IvanYashchuk/pytorch
that referenced
this pull request
Jan 5, 2023
jagadish-amd
pushed a commit
to jagadish-amd/pytorch
that referenced
this pull request
Jul 9, 2025
This PR is to fix https://ontrack-internal.amd.com/browse/SWDEV-534855: test_cuda.py::TestCuda::test_hip_device_count fails on one gpu machine. Needs to cherry-pick it to upstream as well once this PR is merged.
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.
This adds two tests for gradchecks:
That backward is reentrant
That input grad sizes match input sizez.
Uncovers an issue with BatchNorm which is now fixed
Uncovers an issue with advanced indexing which is also now fixed.