[release/2.13] [LNL] test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach Jacobian mismatch
- Dominant language
- Python
- Stars
- 113
- Forks
- 129
- Avg merge
- 5d 9h
- Merged PRs (30d)
- 112
Description
### 🐛 Describe the bug
test_autodiff__foreach_max_outplace_xpu_float64 and test_autodiff__foreach_tan_inplace_xpu_complex128 fail on LNL (Windows). Tests passed on BMG PT2.13 and LNL PT2.12
**Affected Test Cases**
```
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_max_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tan_inplace_xpu_complex128
```
**Error Message**
- test_autodiff__foreach_max_outplace_xpu_float64:
```
_______ TestForeachXPU.test_autodiff__foreach_max_outplace_xpu_float64 ________
[gw0] win32 -- Python 3.12.13 C:\Users\gta\miniforge3\envs\pytorch_2.13\python.exe
Traceback (most recent call last):
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 1364, in test_wrapper
return test(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\unittest\mock.py", line 1861, in _inner
return f(*args, **kw)
^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 1661, in only_fn
return fn(slf, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\repositories\pytorch\pytorch\third_party\torch-xpu-ops\test\xpu\../../../../test\test_foreach.py", line 1827, in test_autodiff
call_gradcheck()
File "C:\Users\gta\repositories\pytorch\pytorch\third_party\torch-xpu-ops\test\xpu\../../../../test\test_foreach.py", line 1810, in call_gradcheck
gradcheck(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_utils.py", line 5501, in gradcheck
return torch.autograd.gradcheck(fn, inputs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 2104, in gradcheck
return _gradcheck_helper(**args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 2133, in _gradcheck_helper
_gradcheck_real_imag(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 1517, in _gradcheck_real_imag
gradcheck_fn(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 1974, in _fast_gradcheck
_check_analytical_numerical_equal(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 1902, in _check_analytical_numerical_equal
raise GradcheckError(
torch.autograd.gradcheck.GradcheckError: Jacobian mismatch for output 0 with respect to input 0,
numerical:-4486117.305731961
analytical:0.16913709857890277
The above quantities relating the numerical and analytical jacobians are computed
in fast mode. See: https://github.com/pytorch/pytorch/issues/53876 for more background
about fast mode. Below, we recompute numerical and analytical jacobians in slow mode:
Numerical:
tensor([[-4.5774e+06],
[-4.5774e+06],
[-4.5774e+06],
[ 8.9722e+00],
[-2.6740e+06],
[-4.2244e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 0.0000e+00],
[ 0.0000e+00]], device='xpu:0', dtype=torch.float64)
Analytical:
tensor([[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[1.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.]], device='xpu:0', dtype=torch.float64)
The max per-element difference (slow mode) is: 4577431.896773176.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_utils.py", line 3553, in wrapper
method(*args, **kwargs)
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 551, in instantiated_test
result = test(self, **param_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_utils.py", line 1934, in wrapper
fn(*args, **kwargs)
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 1376, in test_wrapper
raise e_tracked from e
Exception: Jacobian mismatch for output 0 with respect to input 0,
numerical:-4486117.305731961
analytical:0.16913709857890277
The above quantities relating the numerical and analytical jacobians are computed
in fast mode. See: https://github.com/pytorch/pytorch/issues/53876 for more background
about fast mode. Below, we recompute numerical and analytical jacobians in slow mode:
Numerical:
tensor([[-4.5774e+06],
[-4.5774e+06],
[-4.5774e+06],
[ 8.9722e+00],
[-2.6740e+06],
[-4.2244e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4924e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 4.4861e+06],
[ 0.0000e+00],
[ 0.0000e+00]], device='xpu:0', dtype=torch.float64)
Analytical:
tensor([[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[1.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.],
[0.]], device='xpu:0', dtype=torch.float64)
The max per-element difference (slow mode) is: 4577431.896773176.
Caused by sample input at index 0: SampleInput(input=TensorList[Tensor[size=(5, 5), device="xpu:0", dtype=torch.float64], Tensor[size=(4, 4), device="xpu:0", dtype=torch.float64], Tensor[size=(3, 3), device="xpu:0", dtype=torch.float64], Tensor[size=(2, 2), device="xpu:0", dtype=torch.float64], Tensor[size=(1, 1), device="xpu:0", dtype=torch.float64]], args=(), kwargs={}, broadcasts_input=False, name='')
To execute this test, run the following from the base repo dir:
PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=0 PYTORCH_TEST_WITH_SLOW=1 python ..\..\test\test_foreach.py TestForeachXPU.test_autodiff__foreach_max_outplace_xpu_float64
```
- test_autodiff__foreach_tan_inplace_xpu_complex128"
```
______ TestForeachXPU.test_autodiff__foreach_tan_inplace_xpu_complex128 _______
[gw0] win32 -- Python 3.12.13 C:\Users\gta\miniforge3\envs\pytorch_2.13\python.exe
Traceback (most recent call last):
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 1364, in test_wrapper
return test(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\unittest\mock.py", line 1861, in _inner
return f(*args, **kw)
^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 1661, in only_fn
return fn(slf, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\repositories\pytorch\pytorch\third_party\torch-xpu-ops\test\xpu\../../../../test\test_foreach.py", line 1827, in test_autodiff
call_gradcheck()
File "C:\Users\gta\repositories\pytorch\pytorch\third_party\torch-xpu-ops\test\xpu\../../../../test\test_foreach.py", line 1810, in call_gradcheck
gradcheck(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_utils.py", line 5501, in gradcheck
return torch.autograd.gradcheck(fn, inputs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 2104, in gradcheck
return _gradcheck_helper(**args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 2133, in _gradcheck_helper
_gradcheck_real_imag(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 1488, in _gradcheck_real_imag
gradcheck_fn(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 1974, in _fast_gradcheck
_check_analytical_numerical_equal(
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\autograd\gradcheck.py", line 1902, in _check_analytical_numerical_equal
raise GradcheckError(
torch.autograd.gradcheck.GradcheckError: While considering the imaginary part of complex outputs only, Jacobian mismatch for output 1 with respect to input 1,
numerical:(-2728751.607017474+0.7473802685593948j)
analytical:0.7473802685365531j
The above quantities relating the numerical and analytical jacobians are computed
in fast mode. See: https://github.com/pytorch/pytorch/issues/53876 for more background
about fast mode. Below, we recompute numerical and analytical jacobians in slow mode:
Numerical:
tensor([[ -0.0000-4.1348e-01j, -0.0000-4.1348e-01j,
0.0000+4.1348e-01j, -0.0000-4.1348e-01j,
-0.0000-4.1348e-01j, 0.0000-4.1348e-01j,
-0.0000+4.1348e-01j, 0.0000+4.1348e-01j,
-0.0000-4.1348e-01j, -0.0000-4.1348e-01j,
-0.0000-4.1348e-01j, 0.0000+4.1348e-01j,
-0.0000-4.1348e-01j, -0.0000+4.1348e-01j,
0.0000+4.1348e-01j, 0.0000+4.1348e-01j],
[ 0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ -0.0000-3.5625e-01j, -0.0000-3.5625e-01j,
0.0000+3.5625e-01j, -0.0000-3.5625e-01j,
-0.0000-3.5625e-01j, 0.0000-3.5625e-01j,
-0.0000+3.5625e-01j, 0.0000+3.5625e-01j,
-0.0000-3.5625e-01j, -0.0000-3.5625e-01j,
-0.0000-3.5625e-01j, 0.0000+3.5625e-01j,
-0.0000-3.5625e-01j, -0.0000+3.5625e-01j,
0.0000+3.5625e-01j, 0.0000+3.5625e-01j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ -0.0000-3.7258e-01j, -0.0000-3.7258e-01j,
0.0000+3.7258e-01j, -0.0000-3.7258e-01j,
-0.0000-3.7258e-01j, 0.0000-3.7258e-01j,
-0.0000+3.7258e-01j, 0.0000+3.7258e-01j,
-0.0000-3.7258e-01j, -0.0000-3.7258e-01j,
-0.0000-3.7258e-01j, 0.0000+3.7258e-01j,
-0.0000-3.7258e-01j, -0.0000+3.7258e-01j,
0.0000+3.7258e-01j, 0.0000+3.7258e-01j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000-3.2918e-01j, 0.0000-3.2918e-01j,
0.0000+3.2918e-01j, 0.0000-3.2918e-01j,
0.0000-3.2918e-01j, 0.0000-3.2918e-01j,
0.0000+3.2918e-01j, 0.0000+3.2918e-01j,
0.0000-3.2918e-01j, 0.0000-3.2918e-01j,
0.0000-3.2918e-01j, 0.0000+3.2918e-01j,
0.0000-3.2918e-01j, 0.0000+3.2918e-01j,
0.0000+3.2918e-01j, 0.0000+3.2918e-01j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j],
[ -115720.6361-1.1572e+05j, -107497.0990-1.0750e+05j,
177133.6169+1.7713e+05j, -65213.2624-6.5213e+04j,
-175342.0476-1.7534e+05j, -63142.1176-6.3142e+04j,
176987.1740+1.7699e+05j, 64971.5378+6.4972e+04j,
-189953.4653-1.8995e+05j, -40621.3468-4.0621e+04j,
-2453691.4770-2.4537e+06j, 1518565.3546+1.5186e+06j,
-4452693.2650-4.4527e+06j, 947141.8230+9.4714e+05j,
3687376.3943+3.6874e+06j, 2179351.6798+2.1794e+06j]],
device='xpu:0', dtype=torch.complex128)
Analytical:
tensor([[0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
[0.+0.j, 0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
[0.+0.j, 0.+0.j, 0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
[0.+0.j, 0.+0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.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+1.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j],
[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+1.j, 0.+0.j, 0.+0.j],
[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+1.j, 0.+0.j],
[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+1.j]], device='xpu:0',
dtype=torch.complex128)
The max per-element difference (slow mode) is: 6297059.204423712.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_utils.py", line 3553, in wrapper
method(*args, **kwargs)
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 551, in instantiated_test
result = test(self, **param_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_utils.py", line 1934, in wrapper
fn(*args, **kwargs)
File "C:\Users\gta\miniforge3\envs\pytorch_2.13\Lib\site-packages\torch\testing\_internal\common_device_type.py", line 1376, in test_wrapper
raise e_tracked from e
Exception: While considering the imaginary part of complex outputs only, Jacobian mismatch for output 1 with respect to input 1,
numerical:(-2728751.607017474+0.7473802685593948j)
analytical:0.7473802685365531j
The above quantities relating the numerical and analytical jacobians are computed
in fast mode. See: https://github.com/pytorch/pytorch/issues/53876 for more background
about fast mode. Below, we recompute numerical and analytical jacobians in slow mode:
Numerical:
tensor([[ -0.0000-4.1348e-01j, -0.0000-4.1348e-01j,
0.0000+4.1348e-01j, -0.0000-4.1348e-01j,
-0.0000-4.1348e-01j, 0.0000-4.1348e-01j,
-0.0000+4.1348e-01j, 0.0000+4.1348e-01j,
-0.0000-4.1348e-01j, -0.0000-4.1348e-01j,
-0.0000-4.1348e-01j, 0.0000+4.1348e-01j,
-0.0000-4.1348e-01j, -0.0000+4.1348e-01j,
0.0000+4.1348e-01j, 0.0000+4.1348e-01j],
[ 0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ -0.0000-3.5625e-01j, -0.0000-3.5625e-01j,
0.0000+3.5625e-01j, -0.0000-3.5625e-01j,
-0.0000-3.5625e-01j, 0.0000-3.5625e-01j,
-0.0000+3.5625e-01j, 0.0000+3.5625e-01j,
-0.0000-3.5625e-01j, -0.0000-3.5625e-01j,
-0.0000-3.5625e-01j, 0.0000+3.5625e-01j,
-0.0000-3.5625e-01j, -0.0000+3.5625e-01j,
0.0000+3.5625e-01j, 0.0000+3.5625e-01j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ -0.0000-3.7258e-01j, -0.0000-3.7258e-01j,
0.0000+3.7258e-01j, -0.0000-3.7258e-01j,
-0.0000-3.7258e-01j, 0.0000-3.7258e-01j,
-0.0000+3.7258e-01j, 0.0000+3.7258e-01j,
-0.0000-3.7258e-01j, -0.0000-3.7258e-01j,
-0.0000-3.7258e-01j, 0.0000+3.7258e-01j,
-0.0000-3.7258e-01j, -0.0000+3.7258e-01j,
0.0000+3.7258e-01j, 0.0000+3.7258e-01j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000-3.2918e-01j, 0.0000-3.2918e-01j,
0.0000+3.2918e-01j, 0.0000-3.2918e-01j,
0.0000-3.2918e-01j, 0.0000-3.2918e-01j,
0.0000+3.2918e-01j, 0.0000+3.2918e-01j,
0.0000-3.2918e-01j, 0.0000-3.2918e-01j,
0.0000-3.2918e-01j, 0.0000+3.2918e-01j,
0.0000-3.2918e-01j, 0.0000+3.2918e-01j,
0.0000+3.2918e-01j, 0.0000+3.2918e-01j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+1.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j],
[ 0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+0.0000e+00j, 0.0000+0.0000e+00j,
0.0000+1.0000e+00j, 0.0000+0.0000e+00j],
[ -115720.6361-1.1572e+05j, -107497.0990-1.0750e+05j,
177133.6169+1.7713e+05j, -65213.2624-6.5213e+04j,
-175342.0476-1.7534e+05j, -63142.1176-6.3142e+04j,
176987.1740+1.7699e+05j, 64971.5378+6.4972e+04j,
-189953.4653-1.8995e+05j, -40621.3468-4.0621e+04j,
-2453691.4770-2.4537e+06j, 1518565.3546+1.5186e+06j,
-4452693.2650-4.4527e+06j, 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 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+1.j]], device='xpu:0',
dtype=torch.complex128)
The max per-element difference (slow mode) is: 6297059.204423712.
Caused by sample input at index 0: SampleInput(input=TensorList[Tensor[size=(0,), device="xpu:0", dtype=torch.complex128], Tensor[size=(4, 4), device="xpu:0", dtype=torch.complex128], Tensor[size=(3, 3), device="xpu:0", dtype=torch.complex128], Tensor[size=(0,), device="xpu:0", dtype=torch.complex128], Tensor[size=(0,), device="xpu:0", dtype=torch.complex128]], args=(), kwargs={}, broadcasts_input=False, name='')
To execute this test, run the following from the base repo dir:
PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=0 PYTORCH_TEST_WITH_SLOW=1 python ..\..\test\test_foreach.py TestForeachXPU.test_autodiff__foreach_tan_inplace_xpu_complex128
```
### Versions
PyTorch version: 2.13.0+xpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: Microsoft Windows 11 Pro (10.0.26100 64-bit)
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.31.6
Libc version: N/A
Python version: 3.12.13 | packaged by conda-forge | (main, Mar 5 2026, 16:36:12) [MSC v.1944 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-11-10.0.26100-SP0
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Is XPU available: True
XPU used to build PyTorch: 20260000
Intel GPU driver version:
* 32.0.101.8826 (20260529000000.******+***)
Intel GPU models onboard:
* Intel(R) Arc(TM) 140V GPU (16GB)
Intel GPU models detected:
* [0] _XpuDeviceProperties(name='Intel(R) Arc(TM) 140V GPU (16GB)', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero V2', type='gpu', device_id=0x64A0, uuid=8680a064-0400-0000-0002-000000000000, driver_version='1.15.37858', total_memory=16870MB, local_mem_size=128KB, last_level_cache_size=8192KB, max_compute_units=64, memory_clock_rate=0MHz, memory_bus_width=64-bit, gpu_eu_count=64, gpu_subslice_count=8, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1, is_integrated_gpu=1)
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: False
Caching allocator config: N/A
CPU:
Name: Intel(R) Core(TM) Ultra 7 258V
Manufacturer: GenuineIntel
Family: 774
Architecture: 9
ProcessorType: 3
DeviceID: CPU0
CurrentClockSpeed: 2200
MaxClockSpeed: 2200
L2CacheSize: 14336
L2CacheSpeed: None
Revision: None
Versions of relevant libraries:
[pip3] dpcpp-cpp-rt==2026.0.0
[pip3] intel-cmplr-lib-rt==2026.0.0
[pip3] intel-cmplr-lib-ur==2026.0.0
[pip3] intel-cmplr-lic-rt==2026.0.0
[pip3] intel-opencl-rt==2026.0.0
[pip3] intel-openmp==2026.0.0
[pip3] intel-pti==0.17.0
[pip3] intel-sycl-rt==2026.0.0
[pip3] mkl==2026.0.0
[pip3] mkl-include==2024.2.0
[pip3] mkl-static==2024.2.0
[pip3] mypy_extensions==1.1.0
[pip3] numpy==1.26.2
[pip3] onemkl-license==2026.0.0
[pip3] onemkl-sycl-blas==2026.0.0
[pip3] onemkl-sycl-dft==2026.0.0
[pip3] onemkl-sycl-lapack==2026.0.0
[pip3] onemkl-sycl-rng==2026.0.0
[pip3] onemkl-sycl-sparse==2026.0.0
[pip3] onnx==1.21.0
[pip3] onnx-ir==0.1.16
[pip3] onnxscript==0.6.2
[pip3] optree==0.13.0
[pip3] tbb==2023.0.0
[pip3] tbb-devel==2021.13.1
[pip3] tcmlib==1.5.0
[pip3] torch==2.13.0+xpu
[pip3] torchaudio==2.11.0+xpu
[pip3] torchvision==0.28.0+xpu
[pip3] triton-xpu==3.7.2
[pip3] umf==1.1.0
[conda] dpcpp-cpp-rt 2026.0.0 pypi_0 pypi
[conda] intel-cmplr-lib-rt 2026.0.0 pypi_0 pypi
[conda] intel-cmplr-lib-ur 2026.0.0 pypi_0 pypi
[conda] intel-cmplr-lic-rt 2026.0.0 pypi_0 pypi
[conda] intel-opencl-rt 2026.0.0 pypi_0 pypi
[conda] intel-openmp 2026.0.0 pypi_0 pypi
[conda] intel-pti 0.17.0 pypi_0 pypi
[conda] intel-sycl-rt 2026.0.0 pypi_0 pypi
[conda] mkl 2026.0.0 pypi_0 pypi
[conda] mkl-include 2024.2.0 pypi_0 pypi
[conda] mkl-static 2024.2.0 pypi_0 pypi
[conda] numpy 1.26.2 pypi_0 pypi
[conda] onemkl-license 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-blas 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-dft 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-lapack 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-rng 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-sparse 2026.0.0 pypi_0 pypi
[conda] optree 0.13.0 pypi_0 pypi
[conda] tbb 2023.0.0 pypi_0 pypi
[conda] tbb-devel 2021.13.1 pypi_0 pypi
[conda] tcmlib 1.5.0 pypi_0 pypi
[conda] torch 2.13.0+xpu pypi_0 pypi
[conda] torchaudio 2.11.0+xpu pypi_0 pypi
[conda] torchvision 0.28.0+xpu pypi_0 pypi
[conda] triton-xpu 3.7.2 pypi_0 pypi
[conda] umf 1.1.0 pypi_0 pypi
Contributor guide
Research direction
Start with test/test_foreach.py, especially the test_autodiff path around the reported line numbers, and reproduce the two named tests using the provided PYTORCH_OPINFO_SAMPLE_INPUT_INDEX command on LNL Windows. Done means both max out-of-place float64 and tan in-place complex128 tests pass without Jacobian mismatches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100