torch/testing/_comparison.py: If you are a user and see this message during normal operation please file an issue
Labels: triaged, module: testing

### 🐛 Describe the bug

OOM not correctly caught in comparison under weird striding:

```
import torch
from einops import rearrange


def fast(x) -> torch.Tensor:
    x = rearrange(x, "i j k (two l) -> i (j k l) two", two=2)
    x = torch.view_as_complex(x)
    return x


def slow(x) -> torch.Tensor:
    x = rearrange(x, "i j k (two l) -> i (j k l) two", two=2)
    x = torch.view_as_complex(x.contiguous())
    return x


if __name__ == "__main__":
    device = torch.device("cuda")
    print(torch.cuda.get_device_properties(device))

    a = torch.rand(1024, 8, 16, 256, device=device)

    yf = fast(a)
    ys = slow(a)
    torch.testing.assert_close(yf, ys)
```

```


_CudaDeviceProperties(name='NVIDIA GeForce GT 1030', major=6, minor=1, total_memory=1998MB, multi_processor_count=3)
Traceback (most recent call last):
  File "/foo/localenv/lib/python3.9/site-packages/torch/testing/_comparison.py", line 1224, in not_close_error_metas
    pair.compare()
  File "/foo/localenv/lib/python3.9/site-packages/torch/testing/_comparison.py", line 706, in compare
    self._compare_values(actual, expected)
  File "/foo/localenv/lib/python3.9/site-packages/torch/testing/_comparison.py", line 824, in _compare_values
    compare_fn(
  File "/foo/lib/python3.9/site-packages/torch/testing/_comparison.py", line 994, in _compare_regular_values_close
    matches = torch.isclose(
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 256.00 MiB (GPU 0; 1.95 GiB total capacity; 1.27 GiB already allocated; 180.38 MiB free; 1.27 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "mwe.py", line 26, in <module>
    torch.testing.assert_close(yf, ys)
  File "/foo/localenv/lib/python3.9/site-packages/torch/testing/_comparison.py", line 1489, in assert_close
    error_metas = not_close_error_metas(
  File "/foo/localenv/lib/python3.9/site-packages/torch/testing/_comparison.py", line 1230, in not_close_error_metas
    raise RuntimeError(
RuntimeError: Comparing

TensorLikePair(
    id=(),
    actual=tensor([[0.5528+0.6277j, 0.2594+0.9218j, 0.6938+0.6858j,  ...,
         0.3728+0.2267j, 0.9894+0.9470j, 0.1317+0.7768j],
        [0.6751+0.5199j, 0.6546+0.8712j, 0.7528+0.3251j,  ...,
         0.7132+0.0744j, 0.5763+0.7044j, 0.4192+0.1781j],
        [0.9773+0.2660j, 0.0375+0.5843j, 0.8705+0.7881j,  ...,
         0.4815+0.1623j, 0.9864+0.8712j, 0.6572+0.1675j],
        ...,
        [0.9890+0.5754j, 0.4324+0.9647j, 0.1394+0.7539j,  ...,
         0.3246+0.4463j, 0.5527+0.6973j, 0.0100+0.3823j],
        [0.0878+0.0177j, 0.4789+0.9992j, 0.3644+0.0269j,  ...,
         0.1525+0.1928j, 0.8523+0.3019j, 0.0676+0.2238j],
        [0.4822+0.5437j, 0.6591+0.5484j, 0.0793+0.2377j,  ...,
         0.1888+0.1810j, 0.3516+0.4124j, 0.2638+0.5107j]], device='cuda:0'),
    expected=tensor([[0.5528+0.6277j, 0.2594+0.9218j, 0.6938+0.6858j,  ...,
         0.3728+0.2267j, 0.9894+0.9470j, 0.1317+0.7768j],
        [0.6751+0.5199j, 0.6546+0.8712j, 0.7528+0.3251j,  ...,
         0.7132+0.0744j, 0.5763+0.7044j, 0.4192+0.1781j],
        [0.9773+0.2660j, 0.0375+0.5843j, 0.8705+0.7881j,  ...,
         0.4815+0.1623j, 0.9864+0.8712j, 0.6572+0.1675j],
        ...,
        [0.9890+0.5754j, 0.4324+0.9647j, 0.1394+0.7539j,  ...,
         0.3246+0.4463j, 0.5527+0.6973j, 0.0100+0.3823j],
        [0.0878+0.0177j, 0.4789+0.9992j, 0.3644+0.0269j,  ...,
         0.1525+0.1928j, 0.8523+0.3019j, 0.0676+0.2238j],
        [0.4822+0.5437j, 0.6591+0.5484j, 0.0793+0.2377j,  ...,
         0.1888+0.1810j, 0.3516+0.4124j, 0.2638+0.5107j]], device='cuda:0'),
    rtol=1.3e-06,
    atol=1e-05,
    equal_nan=False,
    check_device=True,
    check_dtype=True,
    check_layout=True,
    check_stride=False,
)

resulted in the unexpected exception above. If you are a user and see this message during normal operation please file an issue at https://github.com/pytorch/pytorch/issues. If you are a developer and working on the comparison functions, please except the previous error and raise an expressive `ErrorMeta` instead.
```

### Versions

Collecting environment information...
PyTorch version: 2.0.1+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux 11 (bullseye) (x86_64)
GCC version: (Debian 10.2.1-6) 10.2.1 20210110
Clang version: 11.0.1-2
CMake version: version 3.25.0
Libc version: glibc-2.31

Python version: 3.9.2 (default, Feb 28 2021, 17:03:44)  [GCC 10.2.1 20210110] (64-bit runtime)
Python platform: Linux-5.10.0-23-amd64-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 11.7.64
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce GT 1030
Nvidia driver version: 515.43.04
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          8
On-line CPU(s) list:             0-7
Thread(s) per core:              1
Core(s) per socket:              8
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           158
Model name:                      Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Stepping:                        13
CPU MHz:                         1379.032
CPU max MHz:                     5000.0000
CPU min MHz:                     800.0000
BogoMIPS:                        7200.00
Virtualization:                  VT-x
L1d cache:                       256 KiB
L1i cache:                       256 KiB
L2 cache:                        2 MiB
L3 cache:                        16 MiB
NUMA node0 CPU(s):               0-7
Vulnerability Itlb multihit:     KVM: Mitigation: VMX disabled
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Retbleed:          Mitigation; Enhanced IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Mitigation; TSX disabled
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.24.1
[pip3] torch==2.0.1+cu117
[pip3] torchaudio==2.0.2+cu117
[pip3] torchvision==0.15.2+cu117
[pip3] triton==2.0.0
[conda] Could not collect