RuntimeError: NYI: Named tensors are not supported with the tracer
Labels: module: onnx, triaged

### 🐛 Describe the bug

Bug
While running the following script, I got the error: "RuntimeError: NYI: Named tensors are not supported with the tracer" 

refer the onnx-model [mnist-1](https://github.com/onnx/models/blob/main/vision/classification/mnist/model/mnist-1.onnx)

To Reproduce
```
import torch.nn.functional as F
from torch import nn
from torchsummary import summary
import torch
device = torch.device("cuda:1" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu")
# device = torch.device("cpu")
print(device)
print(f"Using {device} device")
# Define model
class NeuralNetwork(nn.Module):
    def __init__(self):
        super().__init__()
        constant1 = torch.tensor([
            -0.1615397185087204,
            -0.4338356554508209,
            0.09164135903120041,
            -0.01685221679508686,
            -0.06502643972635269,
            -0.1317378729581833,
            0.020417550578713417,
            -0.1211102306842804
            ])
        constant2 = torch.tensor([
            -0.08224882185459137,
            -0.10886877775192261,
            -0.14103959500789642,
            -0.20486916601657867,
            -0.17913565039634705,
            -0.2154383808374405,
            -0.1338050663471222,
            -0.19572456181049347,
            -0.26825064420700073,
            -0.25821220874786377,
            -0.07615606486797333,
            0.01328414585441351,
            -0.004444644320756197,
            -0.41474083065986633,
            -0.17879115045070648,
            -0.03865588828921318])
        constant3 = torch.randn(16,4,4,10)
        constant4 = torch.tensor([[
                -0.04485602676868439,
                0.007791661191731691,
                0.06810081750154495,
                0.02999374084174633,
                -0.1264096349477768,
                0.14021874964237213,
                -0.055284902453422546,
                -0.04938381537795067,
                0.08432205021381378,
                -0.05454041436314583
            ]])
        self.constant1 = nn.Parameter(data = constant1)
        self.constant2 = nn.Parameter(data = constant2)
        self.constant3 = nn.Parameter(data = constant3)
        self.constant4 = nn.Parameter(data = constant4)
#         self.conv1 = nn.Conv2d(in_channels=1,out_channels=8,kernel_size=(5,5),stride=(1,1),padding='same',dilation=(1,1),groups=1)
        self.conv1 = nn.Conv2d(in_channels=1,out_channels=8,kernel_size=(5,5),stride=(1,1),padding=2,dilation=(1,1),groups=1)
        self.relu1 = nn.ReLU()
        self.reshape1 = nn.Unflatten(0,(1,8,1,1))
        self.reshape2 = nn.Unflatten(0,(1,16,1,1))
        self.reshape3 = nn.Sequential(
                    nn.Flatten(start_dim=0),
                    nn.Unflatten(0,(256,10))
        )
        self.reshape4 = nn.Sequential(
                    nn.Flatten()
        )
        self.maxpool1 = nn.MaxPool2d(kernel_size=(2,2),stride=(2,2))
#         self.conv2 = nn.Conv2d(in_channels=8,out_channels=16,kernel_size=(5,5),stride=(1,1),padding='same',dilation=(1,1),groups=1)
        self.conv2 = nn.Conv2d(in_channels=8,out_channels=16,kernel_size=(5,5),stride=(1,1),padding=2,dilation=(1,1),groups=1)
        self.relu2 = nn.ReLU()
        self.maxpool2 = nn.MaxPool2d(kernel_size=(3,3),stride=(3,3))
    def forward(self, x):
        x = x/255
        x = self.conv1(x)
        reshape1_output = self.reshape1(self.constant1)
        x = x + reshape1_output
        x = self.relu1(x)
        x = self.maxpool1(x)
        x = self.conv2(x)
        reshape2_output = self.reshape2(self.constant2)
        x = x + reshape2_output
        x = self.relu2(x)
        x = self.maxpool2(x)
#         print(self.constant3.shape)
        reshape3_output = self.reshape3(self.constant3)
#         print(reshape3_output.shape)
        x = self.reshape4(x)
#         print(x.shape)
        x = torch.mm(x,reshape3_output)
        x = x + self.constant4
        return x
#
print(device)
model = NeuralNetwork().to(device)
# input = torch.randn(1,28,28)
summary(model=model,input_data=(1,1,28,28),batch_dim = None,device=device)

dummy_input = torch.randn(1, 1, 28, 28, device='cuda:1')
input_names = [ "input73" ] 
output_names = [ "output1" ]

torch.onnx.export(model, dummy_input, "mnist1.onnx", verbose=True, input_names=input_names, output_names=output_names)
```

Expected behavior
No error

Environment
PyTorch Version (e.g., 1.0): 1.10
OS (e.g., Linux): Ubuntu 18.04
How you installed PyTorch (conda, pip, source): conda
Build command you used (if compiling from source):
Python version: 3.7.13
CUDA/cuDNN version: 11.2
GPU models and configuration:
Any other relevant information:

### Versions

```
Collecting environment information...
PyTorch version: 1.10.0+cu111
Is debug build: False
CUDA used to build PyTorch: 11.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.19.5
Libc version: glibc-2.17

Python version: 3.7.13 (default, Mar 29 2022, 02:18:16)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.15.0-188-generic-x86_64-with-debian-buster-sid
Is CUDA available: True
CUDA runtime version: 11.2.67
CUDA_MODULE_LOADING set to: 
GPU models and configuration: 
GPU 0: Tesla V100-PCIE-32GB
GPU 1: Tesla V100-PCIE-32GB

Nvidia driver version: 460.27.04
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.1.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.1.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.1.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.1.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.1.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.1.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.1.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.1.1
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              32
On-line CPU(s) list: 0-31
Thread(s) per core:  2
Core(s) per socket:  8
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz
Stepping:            4
CPU MHz:             800.857
CPU max MHz:         2101.0000
CPU min MHz:         800.0000
BogoMIPS:            4200.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            11264K
NUMA node0 CPU(s):   0-7,16-23
NUMA node1 CPU(s):   8-15,24-31
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.21.5
[pip3] torch==1.10.0+cu111
[pip3] torch-summary==1.4.5
[pip3] torchaudio==0.10.0+rocm4.1
[pip3] torchvision==0.11.0+cu111
[conda] numpy                     1.21.6                   pypi_0    pypi
[conda] torch                     1.10.0+cu111             pypi_0    pypi
[conda] torch-summary             1.4.5                    pypi_0    pypi
[conda] torchaudio                0.10.0+rocm4.1           pypi_0    pypi
[conda] torchvision               0.11.0+cu111             pypi_0    pypi
```