Repository: pytorch
Issue: `nn.functional.max_unpool{n}d`: shape checks fail with `output_size=(C, ...)`.
Labels: module: nn,triaged,module: pooling

## 🐛 Bug
`max_pool` accepts inputs of shape `(N, C, ...)` and `(C, ...)` and so should `max_unpool` be able to detect present or absent batch dimension.
The following, however, fails:
```python
In [1]: import torch

In [2]: import torch.nn.functional as F

In [3]: x = torch.rand(5, 3)  # NOTE: no batch dimension

In [4]: p, i = F.max_pool1d(x, kernel_size=3, return_indices=True)
/home/nik/git/Quansight/pytorch/torch/nn/functional.py:637: UserWarning: Note that order of the arguments: ceil_mode and return_indices will changeto match the args list in nn.MaxPool1d in a future release.
  warnings.warn("Note that order of the arguments: ceil_mode and return_indices will change"

In [5]: F.max_unpool1d(p, i, kernel_size=3, output_size=x.size())
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-5c3a8399c617> in <module>
----> 1 F.max_unpool1d(p, i, kernel_size=3, output_size=x.size())

~/git/Quansight/pytorch/torch/nn/functional.py in max_unpool1d(input, indices, kernel_size, stride, padding, output_size)
    954         _stride = kernel_size
    955     padding = _single(padding)
--> 956     output_size = _unpool_output_size(input, kernel_size, _stride, padding, output_size)
    957     if isinstance(output_size, list):
    958         output_size = output_size + [1]

~/git/Quansight/pytorch/torch/nn/functional.py in _unpool_output_size(input, kernel_size, stride, padding, output_size)
    906             output_size = output_size[2:]
    907         if len(output_size) != len(kernel_size):
--> 908             raise ValueError(
    909                 "output_size should be a sequence containing "
    910                 "{} or {} elements, but it has a length of '{}'".format(

ValueError: output_size should be a sequence containing 1 or 3 elements, but it has a length of '2'

```

## Environment

```
PyTorch version: 1.11.0a0+git4a58729
Is debug build: False
CUDA used to build PyTorch: 11.0
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (GCC) 9.4.0
Clang version: Could not collect
CMake version: version 3.21.3
Libc version: glibc-2.31

Python version: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:23:11)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.4.0-89-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 11.0.221
GPU models and configuration: 
GPU 0: NVIDIA GeForce RTX 2060
GPU 1: NVIDIA GeForce RTX 2060

Nvidia driver version: 465.19.01
cuDNN version: Probably one of the following:
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn.so.8
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn.so.8
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
/usr/local/cuda-11.4.2/targets/x86_64-linux/lib/libcudnn.so.8
/usr/local/cuda-11.4.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
/usr/local/cuda-11.4.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
/usr/local/cuda-11.4.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
/usr/local/cuda-11.4.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
/usr/local/cuda-11.4.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
/usr/local/cuda-11.4.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] mypy==0.812
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.2
[pip3] torch==1.11.0a0+git10d436d
[conda] magma-cuda110             2.5.2                         1    pytorch
[conda] mkl                       2021.3.0           h726a3e6_557    conda-forge
[conda] mkl-include               2021.3.0           h726a3e6_557    conda-forge
[conda] mypy                      0.812            py39h3811e60_2    conda-forge
[conda] mypy_extensions           0.4.3            py39hf3d152e_3    conda-forge
[conda] numpy                     1.21.2           py39hdbf815f_0    conda-forge
[conda] torch                     1.11.0a0+git10d436d           dev_0    <develop>

```

cc @albanD @mruberry @jbschlosser @walterddr