Unable to export timm models with torch._dynamo
Labels: triaged, module: dynamo

### 🐛 Describe the bug

I'm trying to export timm models using torch._dynamo to make use of the graph, but it is failing for most of the networks.

import torch; import timm
import torch._dynamo as dynamo

model_list = ['efficientnet_el',' efficientnet_es', 'efficientnet_em', 'efficientnet_el', 'efficientnet_b0', 'efficientnet_b2', 'efficientnet_b4', 'efficientnet_lite0', 'efficientnet_lite1', 'efficientnet_lite2', 'efficientnet_lite3', 'efficientnet_lite4', 'efficientnetv2_s', 'efficientnetv2_m', 'efficientnetv2_l', 'mobilenetv2_035', 'resnet18', 'resnet34', 'resnet50', 'wide_resnet50_2', 'swinv2_tiny_window8_256', 'swinv2_small_window8_256', 'swinv2_base_window8_256', 'swinv2_large_window12_192_22k', 'dla46x_c', 'dla46_c', 'dla60x_c', 'mobilenetv3_small_050', 'lcnet_050', 'mobilenetv2_050', 'mnasnet_small', 'tf_mobilenetv3_small_075', 'mobilenetv3_small_075', 'tinynet_e', 'tinynet_d', 'lcnet_075', 'tinynet_c', 'mobilenetv3_small_100', 'regnetx_002', 'semnasnet_075', 'lcnet_100', 'xcit_nano_12_p8_384_dist', 'xcit_nano_12_p8_224_dist', 'xcit_nano_12_p16_384_dist', 'xcit_nano_12_p8_224', 'xcit_nano_12_p16_224_dist', 'xcit_nano_12_p16_224', 'regnety_002', 'mobilenetv2_100', 'tinynet_b', 'semnasnet_100', 'mixnet_s', 'regnety_004', 'mnasnet_100', 'spnasnet_100', 'mobilenetv2_110d', 'pit_ti_224', 'mixnet_m', 'pit_ti_distilled_224', 'regnetx_004', 'hardcorenas_b', 'ghostnet_100', 'hardcorenas_a', 'efficientnet_es_pruned', 'resnet10t', 'mobilenetv3_large_100_miil', 'mobilenetv3_rw', 'mobilenetv3_large_100', 'hardcorenas_c', 'fbnetc_100', 'convit_tiny', 'vit_tiny_patch16_224', 'deit_tiny_patch16_224', 'vit_tiny_patch16_384', 'mobilenetv2_120d', 'deit_tiny_distilled_patch16_224', 'regnety_006', 'mobilenetv2_140', 'tinynet_a', 'regnetx_006', 'regnety_008', 'ese_vovnet19b_dw', 'xcit_tiny_12_p8_384_dist', 'xcit_tiny_12_p8_224_dist', 'xcit_tiny_12_p8_224', 'xcit_tiny_12_p16_384_dist', 'xcit_tiny_12_p16_224_dist', 'xcit_tiny_12_p16_224', 'mixnet_l', 'hardcorenas_d', 'densenet121', 'tv_densenet121', 'hardcorenas_e', 'gernet_s', 'hardcorenas_f']

for name in model_list:
    try:
        model = timm.create_model(name)
        inp = torch.rand((1, 3, 224, 224))
        model(inp)
    except:
        print("Failed with Input")
        continue
    try:
        model_graph = torch._dynamo.export(model, torch.randn(1,3,224,224))
        print("Passed")
    except:
        print("Failed")


### Versions

Collecting environment information...
PyTorch version: 2.0.0.dev20230112
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.5 LTS (x86_64)
GCC version: (Ubuntu 11.1.0-1ubuntu1~20.04) 11.1.0
Clang version: 10.0.0-4ubuntu1 
CMake version: version 3.25.0
Libc version: glibc-2.31

Python version: 3.10.8 (main, Nov 24 2022, 14:13:03) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 11.7.99
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA GeForce GT 1030
GPU 1: NVIDIA RTX A6000
GPU 2: NVIDIA RTX A6000

Nvidia driver version: 515.86.01
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.6.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==2.0.0.dev20230112
[pip3] torchaudio==2.0.0.dev20230112
[pip3] torchvision==0.15.0.dev20230112
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0           py310h7f8727e_0  
[conda] mkl_fft                   1.3.1           py310hd6ae3a3_0  
[conda] mkl_random                1.2.2           py310h00e6091_0  
[conda] numpy                     1.23.5          py310hd5efca6_0  
[conda] numpy-base                1.23.5          py310h8e6c178_0  
[conda] pytorch                   2.0.0.dev20230112 py3.10_cuda11.7_cudnn8.5.0_0    pytorch-nightly
[conda] pytorch-cuda              11.7                 h67b0de4_2    pytorch-nightly
[conda] pytorch-mutex             1.0                        cuda    pytorch-nightly
[conda] torchaudio                2.0.0.dev20230112     py310_cu117    pytorch-nightly
[conda] torchtriton               2.0.0+0d7e753227           py310    pytorch-nightly
[conda] torchvision               0.15.0.dev20230112     py310_cu117    pytorch-nightly


cc @mlazos @soumith @voznesenskym @yanboliang @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @chunyuan-w @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @desertfire