Repository: pytorch
Issue: `max_unpool3d` will trigger an assertion fail under compute sanitizer
Labels: module: cuda,triaged,module: sanitizers,module: pooling

### 🐛 Describe the bug

A test case for `torch.nn.functional.max_unpool3d()` terminates normally without compute sanitizer but trigger an assertion error when it's executed under compute sanitizer.

Reproduction:
```python
import torch

def test():
    arg_1_tensor = torch.rand([20, 16, 25, 16, 7], dtype=torch.float32)
    arg_1 = arg_1_tensor.clone().cuda()
    arg_2_tensor = torch.randint(-8,16384,[20, 16, 25, 16, 7], dtype=torch.int64)
    arg_2 = arg_2_tensor.clone().cuda()
    arg_3 = [-3, 14, -12]
    arg_4 = [2, 2, 2]
    arg_5 = [0, 0, 0]
    arg_6 = None
    res = torch.nn.functional.max_unpool3d(arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,)

test()
```
Error log:
```bash
========= COMPUTE-SANITIZER
========= Warp assert
=========     at 0x1c90 in __assertfail
=========     by thread (0,3,0) in block (0,1,61)
=========     Device Frame:void at::native::max_unpooling3d_forward_kernel<float>(at::GenericPackedTensorAccessor<T1, (unsigned long)4, at::DefaultPtrTraits, long>, at::GenericPackedTensorAccessor<long, (unsigned long)4, at::DefaultPtrTraits, long>, T1 *, long, long, long, long) [0x750]
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame: [0x2ea4a1]
=========                in /lib/x86_64-linux-gnu/libcuda.so.1
=========     Host Frame: [0x1433c]
=========                in /lib/x86_64-linux-gnu/libcudart.so.11.0
=========     Host Frame:cudaLaunchKernel [0x69c38]
=========                in /lib/x86_64-linux-gnu/libcudart.so.11.0
=========     Host Frame:at::native::max_unpooling3d_forward_out_cuda(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, at::Tensor&)::{lambda()#1}::operator()() const [0x1f310ba]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so
=========     Host Frame:at::native::max_unpooling3d_forward_out_cuda(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, at::Tensor&) [0x1f3414a]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so
=========     Host Frame:at::native::max_unpooling3d_forward_cuda(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>) [0x1f34e2d]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so
=========     Host Frame:at::(anonymous namespace)::(anonymous namespace)::wrapper__max_unpool3d(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>) [0x2e0af21]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so
=========     Host Frame:c10::impl::wrap_kernel_functor_unboxed_<c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>), &at::(anonymous namespace)::(anonymous namespace)::wrapper__max_unpool3d>, at::Tensor, c10::guts::typelist::typelist<at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long> > >, at::Tensor (at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>) [0x2e0afc7]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so
=========     Host Frame:at::_ops::max_unpool3d::redispatch(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>) [0x1f4203c]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cpu.so
=========     Host Frame:torch::autograd::VariableType::(anonymous namespace)::max_unpool3d(c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>) [0x3744769]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cpu.so
=========     Host Frame:c10::impl::wrap_kernel_functor_unboxed_<c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>), &torch::autograd::VariableType::(anonymous namespace)::max_unpool3d>, at::Tensor, c10::guts::typelist::typelist<c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long> > >, at::Tensor (c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>) [0x3744dfa]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cpu.so
=========     Host Frame:at::_ops::max_unpool3d::call(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>) [0x1fc43fe]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_cpu.so
=========     Host Frame:torch::autograd::THPVariable_max_unpool3d(_object*, _object*, _object*) [0x5c1226]
=========                in /home/yuyao/.local/lib/python3.10/site-packages/torch/lib/libtorch_python.so
=========     Host Frame: [0x15c8de]
=========                in /usr/bin/python3
=========     Host Frame:_PyObject_MakeTpCall [0x1533bb]
=========                in /usr/bin/python3
=========     Host Frame:_PyEval_EvalFrameDefault [0x14bf59]
=========                in /usr/bin/python3
=========     Host Frame:_PyFunction_Vectorcall [0x15d12c]
=========                in /usr/bin/python3
=========     Host Frame:_PyEval_EvalFrameDefault [0x14b5f2]
=========                in /usr/bin/python3
=========     Host Frame:_PyFunction_Vectorcall [0x15d12c]
=========                in /usr/bin/python3
=========     Host Frame:_PyEval_EvalFrameDefault [0x1458a1]
=========                in /usr/bin/python3
=========     Host Frame: [0x142026]
=========                in /usr/bin/python3
=========     Host Frame:PyEval_EvalCode [0x238106]
=========                in /usr/bin/python3
=========     Host Frame: [0x264e18]
=========                in /usr/bin/python3
=========     Host Frame: [0x25dc6b]
=========                in /usr/bin/python3
=========     Host Frame: [0x264b65]
=========                in /usr/bin/python3
=========     Host Frame:_PyRun_SimpleFileObject [0x264048]
=========                in /usr/bin/python3
=========     Host Frame:_PyRun_AnyFileObject [0x263d43]
=========                in /usr/bin/python3
=========     Host Frame:Py_RunMain [0x25517e]
=========                in /usr/bin/python3
=========     Host Frame:Py_BytesMain [0x22b0dd]
=========                in /usr/bin/python3
=========     Host Frame:../sysdeps/nptl/libc_start_call_main.h:58:__libc_start_call_main [0x29d90]
=========                in /lib/x86_64-linux-gnu/libc.so.6
=========     Host Frame:../csu/libc-start.c:379:__libc_start_main [0x29e40]
=========                in /lib/x86_64-linux-gnu/libc.so.6
=========     Host Frame:_start [0x22afd5]
=========                in /usr/bin/python3
========= 
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,61], thread: [0,2,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,61], thread: [1,2,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,61], thread: [2,2,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,61], thread: [3,2,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,61], thread: [4,2,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,61], thread: [5,2,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,61], thread: [6,2,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,20], thread: [0,0,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,20], thread: [1,0,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,20], thread: [2,0,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,20], thread: [3,0,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,20], thread: [4,0,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,20], thread: [5,0,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,0,20], thread: [6,0,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,61], thread: [0,3,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,61], thread: [1,3,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,61], thread: [2,3,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,61], thread: [3,3,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,61], thread: [4,3,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,61], thread: [5,3,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,61], thread: [6,3,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,58], thread: [0,1,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,58], thread: [1,1,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,58], thread: [2,1,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,58], thread: [3,1,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,58], thread: [4,1,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,58], thread: [5,1,0] Assertion `index >= 0 && index < outputImageSize` failed.
/home/yuyao/dev/pytorch/aten/src/ATen/native/cuda/MaxUnpooling.cu:70: max_unpooling3d_forward_kernel: block: [0,1,58], thread: [6,1,0] Assertion `index >= 0 && index < outputImageSize` failed.
========= ERROR SUMMARY: 1 error
```

### Versions

PyTorch version: 1.14.0a0+gita86278b
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: 11.1.0-6
CMake version: version 3.24.1
Libc version: glibc-2.35

Python version: 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-50-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.6.124
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA GeForce RTX 3090
GPU 1: NVIDIA GeForce RTX 3090
GPU 2: NVIDIA GeForce RTX 3090

Nvidia driver version: 515.65.01
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.4.1
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.21.5
[pip3] torch==1.14.0a0+gita86278b
[pip3] torchvision==0.13.1
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               11.3.1               h2bc3f7f_2  
[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.21.5           py39he7a7128_1  
[conda] numpy-base                1.21.5           py39hf524024_1  
[conda] numpydoc                  1.2                pyhd3eb1b0_0 

cc @ngimel