Commit 89423f3
authored
Fix warnings issue in test_tensor_with_grad_to_scalar_warning (#2386)
This PR is to cherry-pick test_torch.py changes from upstream
[22d1359](pytorch@22d1359).
This fixes the below error:
```
_____________________________________________________________________________ TestTorch.test_tensor_with_grad_to_scalar_warning ______________________________________________________________________________
Traceback (most recent call last):
File "/root/PR/pytorch/test/test_torch.py", line 10849, in test_tensor_with_grad_to_scalar_warning
self.assertEqual(len(w), 1)
File "/opt/venv/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 4114, in assertEqual
raise error_metas.pop()[0].to_error( # type: ignore[index]
AssertionError: Scalars are not equal!
Expected 1 but got 2.
Absolute difference: 1
Relative difference: 1.0
To execute this test, run the following from the base repo dir:
python test/test_torch.py TestTorch.test_tensor_with_grad_to_scalar_warning
This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
```
This fixes https://ontrack-internal.amd.com/browse/SWDEV-5324321 parent a97f45c commit 89423f3
1 file changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
10830 | 10830 | | |
10831 | 10831 | | |
10832 | 10832 | | |
10833 | | - | |
10834 | | - | |
| 10833 | + | |
| 10834 | + | |
10835 | 10835 | | |
10836 | 10836 | | |
10837 | 10837 | | |
| |||
10844 | 10844 | | |
10845 | 10845 | | |
10846 | 10846 | | |
10847 | | - | |
10848 | | - | |
10849 | | - | |
10850 | 10847 | | |
10851 | 10848 | | |
10852 | 10849 | | |
| |||
0 commit comments