Repository: pytorch
Issue: [ONNX] DispatchError: No ONNX function found for <OpOverload(op='prims.var', overload='default')> exporting ToTaToNet
Labels: module: onnx,triaged,onnx-triaged

### 🐛 Describe the bug

The goal is to export ToTaToNet (speaker diarization and overlap segmentation) to onnx.

The model by default uses the asteroid-library heavily which internally does some dynamic checks which are incompatible with exporting. Therefore, the relevant files have been modified to remove such checks for static code. This leads to the minimal example being quite heavy, which is why I provide a colab link for you to access.

https://colab.research.google.com/drive/1tvB9ZI_oy8vgQXtuO3HIy3JtvJp5flZx?usp=sharing

Exporting this model requires the dynamo export (as opset 18 or higher is required due to use of col2im).

During the export I get the error:

```
[torch.onnx] Obtain model graph for `ToTaToNet([...]` with `torch.export.export`...
[torch.onnx] Obtain model graph for `ToTaToNet([...]` with `torch.export.export`... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ❌

---------------------------------------------------------------------------

DispatchError                             Traceback (most recent call last)

[/usr/local/lib/python3.10/dist-packages/torch/onnx/_internal/exporter/_core.py](https://localhost:8080/#) in _add_nodes(exported_program, model, lower, registry)
    552                 if lower == "at_conversion":
--> 553                     _handle_call_function_node_with_lowering(
    554                         model,

7 frames

DispatchError: No ONNX function found for <OpOverload(op='prims.var', overload='default')>. Failure message: No decompositions registered for the real-valued input

```

I feel lost in how to approach this, and web-searches did not really turn up any usable results either.
Hence, I would greatly appreciate any help with this problem as I am super excited to be using this model :)
I am also not sure if this qualifies as a bug, so please excuse me if that is not the proper categorization.

Thank you!

### Versions

Version Information taken from the colab-reproduction-example as linked above.

Stepping:                             0
BogoMIPS:                             4400.34
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat md_clear arch_capabilities
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            32 KiB (1 instance)
L1i cache:                            32 KiB (1 instance)
L2 cache:                             256 KiB (1 instance)
L3 cache:                             55 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0,1
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Mitigation; PTE Inversion
Vulnerability Mds:                    Vulnerable; SMT Host state unknown
Vulnerability Meltdown:               Vulnerable
Vulnerability Mmio stale data:        Vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Vulnerable
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Vulnerable
Vulnerability Spectre v1:             Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
Vulnerability Spectre v2:             Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIBRS: Not affected; BHI: Vulnerable (Syscall hardening enabled)
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Vulnerable

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.6.3.3
[pip3] nvidia-cuda-cupti-cu12==12.6.80
[pip3] nvidia-cuda-runtime-cu12==12.6.77
[pip3] nvidia-cudnn-cu12==9.5.1.17
[pip3] nvidia-cufft-cu12==11.3.0.4
[pip3] nvidia-curand-cu12==10.3.7.77
[pip3] nvidia-cusolver-cu12==11.7.1.2
[pip3] nvidia-cusparse-cu12==12.5.4.2
[pip3] nvidia-nccl-cu12==2.23.4
[pip3] nvidia-nvjitlink-cu12==12.6.77
[pip3] nvtx==0.2.10
[pip3] onnx==1.17.0
[pip3] onnxruntime==1.20.1
[pip3] onnxscript==0.1.0.dev20241203
[pip3] optree==0.13.1
[pip3] pynvjitlink-cu12==0.4.0
[pip3] pytorch-lightning==2.4.0
[pip3] pytorch-metric-learning==2.7.0
[pip3] pytorch-ranger==0.1.1
[pip3] torch==2.5.1+cu121
[pip3] torch-audiomentations==0.11.1
[pip3] torch-optimizer==0.1.0
[pip3] torch_pitch_shift==1.2.5
[pip3] torch-stoi==0.2.3
[pip3] torchaudio==2.5.1+cu121
[pip3] torchmetrics==0.11.4
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.20.1+cu121
[conda] Could not collect