Repository: pytorch
Issue: torch.export does not support torchaudio.transforms.Spectrogram
Labels: module: dynamo,oncall: export

### 🐛 Describe the bug

Hi,
I have an issue while exporting torchaudio Spectrogram with torch.onnx.dynamo_export. There seems to be an issue with torch.jit.iinstance which is used to check if the parameter "normalized" of the spectrogram issue is a str. 

Code example:
```
import torch
import torch.nn as nn
import torchaudio

class DataCov(nn.Module):
    def __init__(self):
        super(DataCov, self).__init__()

        self.transform = nn.Sequential(
            torchaudio.transforms.Spectrogram(n_fft=1536, hop_length=768)
        )

    def forward(self, x1):
        return self.transform(x1)

model = DataCov()
input_x = torch.rand((1, 1, 12 * 48000))

export_options = torch.onnx.ExportOptions(dynamic_shapes=False,op_level_debug=False)
export_output = torch.onnx.dynamo_export(model, input_x, export_options=export_options)
```

Error Message:
```
Exception: OnnxExporterError
Failed to export the model to ONNX. Generating SARIF report at 'report_dynamo_export.sarif'. SARIF is a standard format for the output of static analysis tools. SARIF logs can be loaded in VS Code SARIF viewer extension, or SARIF web viewer (https://microsoft.github.io/sarif-web-component/). Please report a bug on PyTorch Github: https://github.com/pytorch/pytorch/issues
torch._dynamo.exc.Unsupported: 'call_function isinstance in skip_files /mnt/IDMT-WORKSPACE/DATA-STORE/muelmo/2021_soundfrequency/env-nightly/lib64/python3.9/site-packages/torch/jit/__init__.py, skipped according skipfiles.SKIP_DIRS'

from user code:
   File "/mnt/IDMT-WORKSPACE/DATA-STORE/muelmo/2021_soundfrequency/export_onnx_model.py", line 58, in forward
    return self.transform(x1)
  File "/mnt/IDMT-WORKSPACE/DATA-STORE/muelmo/2021_soundfrequency/env-nightly/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 1528, in _call_impl
    return forward_call(*args, **kwargs)
  File "/mnt/IDMT-WORKSPACE/DATA-STORE/muelmo/2021_soundfrequency/env-nightly/lib64/python3.9/site-packages/torchaudio/transforms/_transforms.py", line 110, in forward
    return F.spectrogram(
  File "/mnt/IDMT-WORKSPACE/DATA-STORE/muelmo/2021_soundfrequency/env-nightly/lib64/python3.9/site-packages/torchaudio/functional/functional.py", line 119, in spectrogram
    frame_length_norm, window_norm = _get_spec_norms(normalized)
  File "/mnt/IDMT-WORKSPACE/DATA-STORE/muelmo/2021_soundfrequency/env-nightly/lib64/python3.9/site-packages/torchaudio/functional/functional.py", line 233, in _get_spec_norms
    if torch.jit.isinstance(normalized, str):

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information


The above exception was the direct cause of the following exception:

  File "/mnt/IDMT-WORKSPACE/DATA-STORE/muelmo/2021_soundfrequency/export_onnx_model.py", line 67, in <module>
    export_output = torch.onnx.dynamo_export(model, input_x, export_options=export_options)
torch.onnx.OnnxExporterError: Failed to export the model to ONNX. Generating SARIF report at 'report_dynamo_export.sarif'. SARIF is a standard format for the output of static analysis tools. SARIF logs can be loaded in VS Code SARIF viewer extension, or SARIF web viewer (https://microsoft.github.io/sarif-web-component/). Please report a bug on PyTorch Github: https://github.com/pytorch/pytorch/issues
```

SARIF:
{
 "runs":[
  {
   "tool":{
    "driver":{
     "name":"torch.onnx.dynamo_export",
     "contents":[
      "localizedData",
      "nonLocalizedData"
     ],
     "language":"en-US",
     "rules":[],
     "version":"2.2.0.dev20231102+cpu"
    }
   },
   "language":"en-US",
   "newlineSequences":[
    "\r\n",
    "\n"
   ],
   "results":[]
  }
 ],
 "version":"2.1.0",
 "schemaUri":["https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/schemas/sarif-schema-2.1.0.json"](https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/schemas/sarif-schema-2.1.0.json)
}

Thank your for helping! 


### Versions

Collecting environment information...
PyTorch version: 2.2.0.dev20231102+cpu
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: AlmaLinux 8.8 (Sapphire Caracal) (x86_64)
GCC version: (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)
Clang version: Could not collect
CMake version: version 3.20.2
Libc version: glibc-2.28

Python version: 3.9.16 (main, Jun 30 2023, 08:01:58)  [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (64-bit runtime)
Python platform: Linux-4.18.0-477.21.1.el8_8.x86_64-x86_64-with-glibc2.28
Is CUDA available: False
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration:
GPU 0: NVIDIA A10
GPU 1: NVIDIA A10
GPU 2: NVIDIA A10
GPU 3: NVIDIA A10

Nvidia driver version: 535.86.10
cuDNN version: Could not collect
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):              112
On-line CPU(s) list: 0-111
Thread(s) per core:  2
Core(s) per socket:  28
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Gold 6330 CPU @ 2.00GHz
Stepping:            6
CPU MHz:             2000.000
BogoMIPS:            4000.00
Virtualization:      VT-x
L1d cache:           48K
L1i cache:           32K
L2 cache:            1280K
L3 cache:            43008K
NUMA node0 CPU(s):   0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110
NUMA node1 CPU(s):   1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111
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 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.24.1
[pip3] onnx==1.15.0
[pip3] onnxscript==0.1.0.dev20231103
[pip3] torch==2.2.0.dev20231102+cpu
[pip3] torchaudio==2.2.0.dev20231102+cpu
[pip3] torchvision==0.17.0.dev20231102+cpu
[conda] Could not collect

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4