[ONNX] Exporting the operator ::concat to ONNX opset version 13 is not supported.
Labels: module: onnx, triaged

### 🐛 Describe the bug

I want to export a UNet-like model to ONNX, but I get: `UnsupportedOperatorError: Exporting the operator ::concat to ONNX opset version 13 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.`

```python
# traced_model was generated by torch.jit.trace

image = torch.rand((1,3,1024,1024))
torch.onnx.export(traced_model, image, "model.onnx", input_names=input_names, output_names=output_names)
```

```
.../python3.9/site-packages/torch/onnx/utils.py:461: UserWarning: no signature found for <torch.ScriptMethod object at 0x7fad714a5090>, skipping _decide_input_format
  warnings.warn("%s, skipping _decide_input_format" % e)
Traceback (most recent call last):
  File ".../python3.9/site-packages/IPython/core/interactiveshell.py", line 3433, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "/tmp/ipykernel_17474/1981464861.py", line 1, in <module>
    torch.onnx.export(traced_model, image, "model.onnx", input_names=input_names, output_names=output_names)
  File ".../python3.9/site-packages/torch/onnx/__init__.py", line 350, in export
    return utils.export(
  File ".../python3.9/site-packages/torch/onnx/utils.py", line 163, in export
    _export(
  File ".../python3.9/site-packages/torch/onnx/utils.py", line 1074, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File ".../python3.9/site-packages/torch/onnx/utils.py", line 731, in _model_to_graph
    graph = _optimize_graph(
  File ".../python3.9/site-packages/torch/onnx/utils.py", line 308, in _optimize_graph
    graph = _C._jit_pass_onnx(graph, operator_export_type)
  File ".../python3.9/site-packages/torch/onnx/__init__.py", line 416, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File ".../python3.9/site-packages/torch/onnx/utils.py", line 1421, in _run_symbolic_function
    raise symbolic_registry.UnsupportedOperatorError(
torch.onnx.symbolic_registry.UnsupportedOperatorError: Exporting the operator ::concat to ONNX opset version 13 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.
```

The model is constructed dynamically, therefore it is hard to post it here. I wanted to create a MWE, but it does not display this behavior:

```python

class Concatenate(nn.Module):
    def __init__(self) -> None:
        super().__init__()

        self.linear = nn.Linear(10,10)

    def forward(self, x,y):
        x = self.linear(x)
        y = self.linear(y)
        return torch.concat([x,y], 1)

concatenate_model = Concatenate()
example_input = (torch.rand(1,1,10), torch.rand(1,2,10))

traced_model = torch.jit.trace(concatenate_model, example_input)

torch.onnx.export(traced_model, example_input, "concatenate.onnx", input_names=["x", "y"], output_names=["result"])
```

```
.../python3.9/site-packages/torch/onnx/utils.py:461: UserWarning: no signature found for <torch.ScriptMethod object at 0x7f34a56d0950>, skipping _decide_input_format
  warnings.warn("%s, skipping _decide_input_format" % e)

(no error)
```

It seems that, due to its easier structure, a different approach is taken for the creation of the ONNX graph?

### Versions

```
PyTorch version: 1.12.1
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Linux Mint 18.1 Serena (x86_64)
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Clang version: Could not collect
CMake version: version 3.5.1
Libc version: glibc-2.23

Python version: 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:45:29)  [GCC 10.4.0] (64-bit runtime)
Python platform: Linux-4.4.0-109-generic-x86_64-with-glibc2.23
Is CUDA available: True
CUDA runtime version: 8.0.61
CUDA_MODULE_LOADING set to: 
GPU models and configuration: GPU 0: NVIDIA GeForce GTX TITAN X
Nvidia driver version: 515.76
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.23.5
[pip3] pytorch-lightning==1.8.3.post1
[pip3] torch==1.12.1
[pip3] torchmetrics==0.10.3
[pip3] torchvision==0.13.1
[conda] blas                      1.0                         mkl    conda-forge
[conda] cudatoolkit               10.2.89              h8f6ccaa_8    nvidia
[conda] libblas                   3.9.0            16_linux64_mkl    conda-forge
[conda] libcblas                  3.9.0            16_linux64_mkl    conda-forge
[conda] liblapack                 3.9.0            16_linux64_mkl    conda-forge
[conda] liblapacke                3.9.0            16_linux64_mkl    conda-forge
[conda] mkl                       2022.1.0           hc2b9512_224  
[conda] numpy                     1.23.5           py39h3d75532_0    conda-forge
[conda] pytorch                   1.12.1          py3.9_cuda10.2_cudnn7.6.5_0    pytorch
[conda] pytorch-lightning         1.8.3.post1              pypi_0    pypi
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchmetrics              0.10.3                   pypi_0    pypi
[conda] torchvision               0.13.1               py39_cu102    pytorch
```