-
Notifications
You must be signed in to change notification settings - Fork 806
fix: remove redundant self-assignment out_ = out_ #3367
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||
| # Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||||||
| # | ||||||
| # See LICENSE for license information. | ||||||
|
|
||||||
| import pytest | ||||||
| import torch | ||||||
| from transformer_engine.pytorch import DotProductAttention | ||||||
|
|
||||||
|
|
||||||
| @pytest.mark.skipif(not torch.cuda.is_available(), reason="CUDA not available") | ||||||
| def test_softmax_offset_grad_none_in_eval(): | ||||||
|
Comment on lines
+10
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The QA jobs enumerate test files explicitly, but none includes this new test, so CI silently skips the intended inference regression coverage. Knowledge Base Used: Tests and QA Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
| """Regression test: eval mode leaves softmax_offset.grad as None. | ||||||
|
|
||||||
| The context-parallel test helper previously crashed here by calling | ||||||
| core_attn.softmax_offset.grad.zero_() unconditionally for non-vanilla | ||||||
| softmax. In eval mode requires_grad is False and no backward has run, | ||||||
| so .grad must stay None. | ||||||
| """ | ||||||
| core_attn = ( | ||||||
| DotProductAttention(8, (64, 64), num_gqa_groups=4, softmax_type="learnable").cuda().eval() | ||||||
| ) | ||||||
| assert not core_attn.softmax_offset.requires_grad | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When this test runs on a CUDA-enabled worker,
Suggested change
Knowledge Base Used: Tests and QA |
||||||
Uh oh!
There was an error while loading. Please reload this page.