Repository: pytorch
Issue: Support for 5-D output image tensors in `Col2Im`.
Labels: module: nn,triaged,enhancement,module: python frontend

Currently, torch's `Col2Im` function only supports 3-D and 4-D (batched) output tensors, i.e. the image that it arranges the input to. This also means that only 2-D `output_size` and `kernel_size` are supported.

It would be great if `Col2Im` could be extended to support 5-D output image tensors. This would mean the extension of the current implementation to support 3-D `output_size` and `kernel_size`.

If this sounds good, I would be happy to work on this PR myself, and the extension is not very difficult to implement, as the current implementation of `Col2Im` does most of the bootstrapping.

A reference implementation of `Col2Im` with 5-D support is found at https://github.com/onnx/onnx/blob/4c3ed5e08be75bbe1eeb6818e490b1b6a370183e/onnx/reference/ops/op_col2im.py#L145.

### Additional context

An example of the input and output of `Col2Im` with 5-D output support is given below (borrowed from the Onnx operator reference):
```py
# shape of input = (1, 10, 12)
input = 
[
    [
            [1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56],
            [2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 57],
            [3, 8, 13, 18, 23, 28, 33, 38, 43, 48, 53, 58],
            [4, 9, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59],
            [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60],
            [61, 66, 71, 76, 81, 86, 91, 96, 101, 106, 111, 116],
            [62, 67, 72, 77, 82, 87, 92, 97, 102, 107, 112, 117],
            [63, 68, 73, 78, 83, 88, 93, 98, 103, 108, 113, 118],
            [64, 69, 74, 79, 84, 89, 94, 99, 104, 109, 114, 119],
            [65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120],
    ]
]

output_size = [3, 4, 5]
kernel_size = [1, 1, 5]
```

The output for these inputs would be:
```py
# shape of output =  (1, 2, 3, 4, 5)
output = [
        [
            [
                [
                    [1, 2, 3, 4, 5],
                    [6, 7, 8, 9, 10],
                    [11, 12, 13, 14, 15],
                    [16, 17, 18, 19, 20],
                ],
                [
                    [21, 22, 23, 24, 25],
                    [26, 27, 28, 29, 30],
                    [31, 32, 33, 34, 35],
                    [36, 37, 38, 39, 40],
                ],
                [
                    [41, 42, 43, 44, 45],
                    [46, 47, 48, 49, 50],
                    [51, 52, 53, 54, 55],
                    [56, 57, 58, 59, 60],
                ],
            ],
            [
                [
                    [61, 62, 63, 64, 65],
                    [66, 67, 68, 69, 70],
                    [71, 72, 73, 74, 75],
                    [76, 77, 78, 79, 80],
                ],
                [
                    [81, 82, 83, 84, 85],
                    [86, 87, 88, 89, 90],
                    [91, 92, 93, 94, 95],
                    [96, 97, 98, 99, 100],
                ],
                [
                    [101, 102, 103, 104, 105],
                    [106, 107, 108, 109, 110],
                    [111, 112, 113, 114, 115],
                    [116, 117, 118, 119, 120],
                ],
            ],
        ]
    ]
```

cc @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki