Error using torch.onnx.dynamo_export
Labels: module: onnx, triaged

### 🐛 Describe the bug

I am using dynamo_exporter from pytorch to convert a torchscript model to ONNX. The torchscript model uses ```aten::stft``` which cannot be exported using torch.onnx.export. I get the following errors when doing the conversion.

Error:
```
/home/divyansh/anaconda3/envs/onnx/lib/python3.11/site-packages/torch/onnx/_internal/exporter.py:130: UserWarning: torch.onnx.dynamo_export only implements opset version 18 for now. If you need to use a different opset version, please register them with register_custom_op.
  warnings.warn(
Traceback (most recent call last):
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/inspect.py", line 2601, in _signature_from_callable
    sig = _get_signature_of(call)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/inspect.py", line 2521, in _signature_from_callable
    return _signature_from_builtin(sigcls, obj,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/inspect.py", line 2328, in _signature_from_builtin
    raise ValueError("no signature found for builtin {!r}".format(func))
ValueError: no signature found for builtin <instancemethod __call__ at 0x7fc1dd182a70>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/site-packages/torch/onnx/_internal/exporter.py", line 1195, in dynamo_export
    ).export()
      ^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/site-packages/torch/onnx/_internal/exporter.py", line 941, in export
    graph_module = self.options.fx_tracer.generate_fx(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/site-packages/torch/onnx/_internal/fx/dynamo_graph_extractor.py", line 199, in generate_fx
    graph_module, graph_guard = torch._dynamo.export(
                                ^^^^^^^^^^^^^^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/site-packages/torch/_dynamo/eval_frame.py", line 1117, in inner
    original_signature = inspect.signature(call_to_inspect)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/inspect.py", line 3280, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/inspect.py", line 3028, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/inspect.py", line 2604, in _signature_from_callable
    raise ValueError(msg) from ex
ValueError: no signature found for <torch.ScriptMethod object at 0x7fc17c2b3dd0>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/divyansh/MoonPy/torchscriptToONNX.py", line 22, in <module>
    torch.onnx.dynamo_export(
  File "/home/divyansh/anaconda3/envs/onnx/lib/python3.11/site-packages/torch/onnx/_internal/exporter.py", line 1206, in dynamo_export
    raise OnnxExporterError(
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
```

Code to reproduce:
```
import torch
import torchaudio
import torch.onnx

jit_preprocessor = torch.jit.load("tmp.pt")

wav_file = "/home/divyansh/AAT3_16khz.wav"
signal, sample_rate = torchaudio.load(wav_file)
length = torch.tensor(signal.size(1)).unsqueeze(0)

input_names = ["input_signal", "length"]
output_names = ["output_features", "output_lengths"]
onnx_file = "NeMoPreprocessor.onnx"

jit_preprocessor.eval()

torch.onnx.dynamo_export(
    jit_preprocessor,
    (signal, length),
    onnx_file,
    verbose=True,
    opset_version=18
)
```
Required files and SARIF report: [dynamo_export_bug_files.zip](https://github.com/pytorch/pytorch/files/12703871/dynamo_export_bug_files.zip)



### Versions

```
PyTorch version: 2.2.0.dev20230922+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.27.1
Libc version: glibc-2.35

Python version: 3.11.4 (main, Jul  5 2023, 13:45:01) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.2.0-33-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4060 Laptop GPU
Nvidia driver version: 535.104.05
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.5
/usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudnn.so.8.9.4
/usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.9.4
/usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.9.4
/usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.9.4
/usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.9.4
/usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.9.4
/usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.9.4
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
Address sizes:                      39 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             20
On-line CPU(s) list:                0-19
Vendor ID:                          GenuineIntel
Model name:                         13th Gen Intel(R) Core(TM) i7-13700H
CPU family:                         6
Model:                              186
Thread(s) per core:                 2
Core(s) per socket:                 14
Socket(s):                          1
Stepping:                           2
CPU max MHz:                        5000.0000
CPU min MHz:                        400.0000
BogoMIPS:                           5836.80
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 tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          544 KiB (14 instances)
L1i cache:                          704 KiB (14 instances)
L2 cache:                           11.5 MiB (8 instances)
L3 cache:                           24 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-19
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] numpy==1.24.4
[pip3] pytorch-triton==2.1.0+6e4932cda8
[pip3] torch==2.2.0.dev20230922+cu118
[pip3] torchaudio==2.2.0.dev20230922+cu118
[pip3] torchvision==0.17.0.dev20230922+cu118
[pip3] triton==2.0.0
[conda] blas                      1.0                         mkl  
[conda] mkl                       2023.1.0         h213fc3f_46343  
[conda] mkl-service               2.4.0           py311h5eee18b_1  
[conda] mkl_fft                   1.3.6           py311ha02d727_1  
[conda] mkl_random                1.2.2           py311ha02d727_1  
[conda] numpy                     1.24.4                   pypi_0    pypi
[conda] numpy-base                1.25.2          py311hf175353_0  
[conda] pytorch-triton            2.1.0+6e4932cda8          pypi_0    pypi
[conda] torch                     2.2.0.dev20230922+cu118          pypi_0    pypi
[conda] torchaudio                2.2.0.dev20230922+cu118          pypi_0    pypi
[conda] torchvision               0.17.0.dev20230922+cu118          pypi_0    pypi
[conda] triton                    2.0.0                    pypi_0    pypi
```