implemented test and Changed assert to TORCH_CHECK #88808 (#91273)
Fixes #88808
Replaced
`AT_ASSERT(dims < MAX_TENSORINFO_DIMS) `
in aten/src/ATen/cuda/detail/TensorInfo.cuh by
```
data = p;
dims = dim;
TORCH_CHECK(dims < MAX_TENSORINFO_DIMS, "CUDA Tensors cannot have more than 25 dimensions");
}
```
In : torch/testing/_internal/common_methods_invocations.py
```
def error_inputs_median(op_info, device, **kwargs):
x = torch.tensor([[[[[[[[[[[[[[[[[[[[[[[[[nan],
[nan]]]]]]]]]]]]]]]]]]]]]]]]], device=device)
if device=='cuda':
yield ErrorInput(SampleInput(x, kwargs=dict(dim=(-1))),
error_type=RuntimeError,
error_regex='CUDA Tensors cannot have more than 25 dimensions')
else:
return
```
And
```
OpInfo('median',
...
error_inputs_func=error_inputs_median,
...
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91273
Approved by: https://github.com/ngimel