[upstream_ut] test_gather_backward_one_dim_xpu accuracy mismatch
- Dominant language
- Python
- Stars
- 113
- Forks
- 128
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 107
Description
## Description
`test_gather_backward_one_dim_xpu` fails with incorrect gradient values from the 1-D gather backward on XPU.
## Error log
```
File "test/test_torch.py", line 2023, in _test_gather_backward_one_dim
self.assertEqual(grad, expected, atol=0, rtol=0)
AssertionError: Tensor-likes are not equal!
Mismatched elements: 1741 / 2989 (58.2%)
Greatest absolute difference: 4.0 at index (423,)
Greatest relative difference: 3.5682600696418376e-07 at index (423,)
```
## Reproduce
Using pytorch/pytorch#196421 on a PVC machine:
```
python test/test_torch.py TestTorchDeviceTypeXPU.test_gather_backward_one_dim_xpu
```
## Expected
gather backward accumulates gradients correctly (bit-exact per the test's atol=0/rtol=0), matching CPU/CUDA.
_Filed with AI assistance; reproduced per the details above._
Contributor guide
Research direction
Start with test/test_torch.py and the _test_gather_backward_one_dim test around line 2023. Run TestTorchDeviceTypeXPU.test_gather_backward_one_dim_xpu on a PVC machine and compare the XPU gradient with the CPU/CUDA results and the exact assertions. Done means the XPU gather backward gradients match the expected values with atol=0 and rtol=0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100