intel / intel/torch-xpu-ops

[Bug Skip]: test_numpy_ref_linalg_tensorinv_xpu_float64 — Mismatched elements (66.7%) vs NumPy reference on PVC

Open
#4,313 3 comments 0 reactions 0 assignees View on GitHub
agent:needs-human dependency component: oneMKL hw: PVC skipped test: ut
Dominant language
Python
Stars
113
Forks
128
Avg merge
5d 13h
Merged PRs (30d)
107

Description

## Bug description

`TestCommonXPU.test_numpy_ref_linalg_tensorinv_xpu_float64` fails with a `Tensor-likes are not close!` assertion when comparing `torch.linalg.tensorinv` output against the NumPy reference (`np.linalg.tensorinv`). The error indicates a numerical accuracy issue in the XPU implementation of `linalg.tensorinv`.

## Error

```
Exception: Tensor-likes are not close!

Mismatched elements: 96 / 144 (66.7%)
Greatest absolute difference: 1.6307882880566502 at index (0, 0, 0, 1, 2) (up to 1e-07 allowed)
Greatest relative difference: 107.4749653215916 at index (1, 0, 0, 1, 1) (up to 1e-07 allowed)

Caused by reference input at index 0: SampleInput(input=Tensor[size=(2, 2, 3, 12, 1), device="xpu:0", dtype=torch.float64], args=(), kwargs={'ind': '3'}, broadcasts_input=False, name='')
```

## To reproduce

```
PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=0 python test/test_ops.py TestCommonXPU.test_numpy_ref_linalg_tensorinv_xpu_float64
```

## Environment

- **Platform:** PVC (Intel Data Center GPU Max)
- **CI run:** https://hud.pytorch.org/pr/pytorch/pytorch/179550
- **Date:** 2026-07-10
- **PyTorch PR:** https://github.com/pytorch/pytorch/pull/179550

## Additional context

`linalg.tensorinv` depends on SVD or linear solve internally. This may be a numerical accuracy issue in the oneMKL gesvd or related linear algebra path on XPU. The OpInfo for `linalg.tensorinv` has no existing XPU skips — only MPS entries.

Contributor guide

Open the contributing guide

Research direction

Start by running the reproducer in test/test_ops.py: TestCommonXPU.test_numpy_ref_linalg_tensorinv_xpu_float64 with PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=0. Trace the XPU linalg.tensorinv path, including its SVD or linear-solve and oneMKL gesvd-related behavior, then compare against the NumPy reference. Done means the test passes for the reported PVC float64 input within the stated tolerance.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python, pytorch
Domain
backend, performance, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.