Repository: pytorch
Issue: max_pool1d() returns when given invalid large `kernel_size` inputs
Labels: module: nn,triaged,module: correctness (silent),module: edge cases

### 🐛 Describe the bug

When given invalid large `kernel_size` inputs, `max_pool1d()` does not raise an error but rather returns an output.

### Example to reproduce

```python
import torch

self = torch.full((2, 10, 4,), 0.5, dtype=torch.float64, requires_grad=False)
kernel_size = [4294967295]  # 2^32 - 1
stride = [1]
padding = [0]
dilation = [1]
ceil_mode = True
torch.max_pool1d(self, kernel_size, stride, padding, dilation, ceil_mode)
```

### Result

```python
>>> kernel_size = [2**32 - 1]
>>> torch.max_pool1d(self, kernel_size, stride, padding, dilation, ceil_mode)
tensor([[[0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf]],

        [[0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf],
         [0.5000, 0.5000, 0.5000, 0.5000,   -inf]]], dtype=torch.float64)
>>> kernel_size = [2**32]
>>> torch.max_pool1d(self, kernel_size, stride, padding, dilation, ceil_mode)
tensor([[[0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000]],

        [[0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000],
         [0.5000, 0.5000, 0.5000, 0.5000]]], dtype=torch.float64)
```

### Expected behavior

**_Immediately_** raises runtime error indicating invalid computed output size, such as what is currently done for smaller inputs:

```stacktrace
Traceback (most recent call last):   
  File "<stdin>", line 1, in <module>
RuntimeError: max_pool1d() Invalid computed output size:
```

### Note

This bug was inspired by the high-priority issue https://github.com/pytorch/pytorch/issues/73190 which used much larger inputs.

### Versions

PyTorch version: 1.10.1+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.4 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: version 3.16.3
Libc version: glibc-2.31

Python version: 3.9.7 (default, Sep 16 2021, 13:09:58) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.11.0-27-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration:
GPU 0: NVIDIA GeForce GTX 1080 Ti
GPU 1: NVIDIA GeForce GTX 1080 Ti
GPU 2: NVIDIA GeForce GTX 1080 Ti
GPU 3: NVIDIA GeForce GTX 1080 Ti

Nvidia driver version: 470.103.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.4
[pip3] torch==1.10.1
[conda] mypy-extensions 0.4.3 pypi_0 pypi
[conda] numpy 1.21.4 pypi_0 pypi
[conda] torch 1.10.1 pypi_0 pypi



cc @albanD @mruberry @jbschlosser @walterddr @kshitij12345