inf is returned by nn.TransformerEncoderLayer#3674
Draft
Stonepia wants to merge 2 commits into
Draft
Conversation
inf is returned by nn.TransformerEncoderLayer
11 tasks
Contributor
|
@copilot The Python lint (flake8/ruff) check failed. Please fix the lint errors in this PR. Lint job log: https://github.com/intel/torch-xpu-ops/actions/runs/25865859919 Instructions:
|
Agent-Logs-Url: https://github.com/intel/torch-xpu-ops/sessions/263ed202-9dbb-4bef-901e-8f32d916faa2 Co-authored-by: chuanqi129 <13608516+chuanqi129@users.noreply.github.com>
Contributor
Fixed in commit a5d61d7. The PYFMT formatter required collapsing the multi-line |
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.
inf is returned by nn.TransformerEncoderLayer
Fixes #2015
Root Cause: The test_transformerencoderlayer test added XPU to fast_path_device check (commit 792afdf), causing the test to expect NaN output on XPU when a fully-masked row is passed. However, XPU's TransformerEncoderLayer does not implement the fast path (unlike CUDA/CPU), so the attention implementation produces inf/NaN due to float16 overflow or softmax over -inf values rather than the expected NaN pattern. For float16, large input values ([20., 30., 40., 50.]) cause overflow in the softmax/attention computation, producing NaN instead of the expected reference values.
Failed Tests:
test/test_nn.py::TestNNDeviceTypeXPU::test_transformerencoderlayer_gelu_xpu_float16test/test_nn.py::TestNNDeviceTypeXPU::test_transformerencoderlayer_xpu_float16test/test_nn.py::TestNNDeviceTypeXPU::test_transformerencoderlayer_xpu_float32test/test_nn.py::TestNNDeviceTypeXPU::test_transformerencoderlayer_xpu_float64Diff stat: