Repository: pytorch
Issue: `max_unpool` and `max_pool` will trigger INTERNAL ASSERT FAIL in JIT
Labels: oncall: jit

### 🐛 Describe the bug

`max_unpool` will trigger INTERNAL ASSERT FAIL in JIT but work normally without JIT

```py
import torch
class M(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.indices = torch.randint(0, 2, [1, 1, 4], dtype=torch.int64)
        self.kernel_size = [1]
        self.output_size = [1, 1, 2]
        self.padding = [1]

        # invalid inputs
        self.stride = [True,]

    def forward(self, input):
        indices = self.indices
        kernel_size = self.kernel_size
        stride = self.stride
        padding = self.padding
        output_size = self.output_size

        return torch.nn.functional.max_unpool1d(input, indices, kernel_size, stride=stride, padding=padding, output_size=output_size, )

input = torch.rand([1, 1, 4], dtype=torch.float32)

fn = M().to('cpu')
print(fn(input))

jit_fn = torch.jit.script(fn)
print(jit_fn(input))
```

```
tensor([[[0.8325, 0.0918]]])

RuntimeError: isIntList() INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1664608354311/work/aten/src/ATen/core/ivalue_inl.h":1833, please report a bug to PyTorch. Expected IntList but got Int
```

### Versions

```
PyTorch version: 1.13.0.dev20221001
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.13 (main, Aug 25 2022, 23:26:10)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.19.5-051905-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.7.99
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3060
Nvidia driver version: 515.65.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] numpy==1.23.3
[pip3] torch==1.13.0.dev20221001
[pip3] torchaudio==0.13.0.dev20221001
[pip3] torchvision==0.14.0.dev20221001
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.23.3                   pypi_0    pypi
[conda] numpy-base                1.23.1           py39ha15fc14_0  
[conda] pytorch                   1.13.0.dev20221001 py3.9_cuda11.7_cudnn8.5.0_0    pytorch-nightly
[conda] pytorch-cuda              11.7                 h67b0de4_0    pytorch-nightly
[conda] pytorch-mutex             1.0                        cuda    pytorch-nightly
[conda] torch                     1.13.0.dev20220923+cu116          pypi_0    pypi
[conda] torchaudio                0.13.0.dev20220923+cu116          pypi_0    pypi
[conda] torchvision               0.14.0.dev20220923+cu116          pypi_0    pypi
```