Repository: pytorch
Issue: export onnx error with sfft
Labels: module: onnx,triaged

### 🐛 Describe the bug

code
``` python
import torch
from torch import nn
import torchaudio
DNN_DATA_TYPE = torch.float32


class DataCov(nn.Module):
    def __init__(self):
        super(DataCov, self).__init__()

        self.transform = nn.Sequential(
            torchaudio.transforms.MelSpectrogram(sample_rate=48000, n_fft=1536, hop_length=768, f_min=20, f_max=20000)
        )

    def forward(self, x1):
        return self.transform(x1)

def load_data_cov():
    module = DataCov().to(DNN_DATA_TYPE).to('cpu')
    module.eval()
    return module

def export_data_cov(path='data_cov.onnx', batch_size=1):
    data_cov = load_data_cov()
    x = torch.randn((batch_size, 1, 12 * 48000), dtype=DNN_DATA_TYPE, device='cpu')
    y = data_cov(x)
    input_names = ["x"]
    output_names = ["output"]

    output_path = path
    torch.onnx.export(
        data_cov,
        x,
        output_path,
        export_params=True,
        verbose=True,
        training=torch.onnx.TrainingMode.EVAL,
        input_names=input_names,
        output_names=output_names
    )

export_data_cov()
```

return error:

torch.onnx.errors.SymbolicValueError: STFT does not currently support complex types  [Caused by the value '73 defined in (%73 : Float(*, *, strides=[577536, 1], requires_grad=0, device=cpu) = onnx::Reshape[allowzero=0](%63, %72), scope: module.DataCov::/torch.nn.modules.container.Sequential::transform/torchaudio.transforms._transforms.MelSpectrogram::transform.0/torchaudio.transforms._transforms.Spectrogram::spectrogram # C:\Users\dell\miniconda3\envs\ai_mos_export_onnx\lib\site-packages\torch\functional.py:703:0
)' (type 'Tensor') in the TorchScript graph. The containing node has kind 'onnx::Reshape'.] 

### Versions

Collecting environment information...
PyTorch version: 2.5.1+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 专业版 (10.0.19045 64 位)
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.30.5
Libc version: N/A

Python version: 3.10.15 | packaged by Anaconda, Inc. | (main, Oct  3 2024, 07:22:19) [MSC v.1929 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19045-SP0
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Name: 12th Gen Intel(R) Core(TM) i5-12400
Manufacturer: GenuineIntel
Family: 205
Architecture: 9
ProcessorType: 3
DeviceID: CPU0
CurrentClockSpeed: 2500
MaxClockSpeed: 2500
L2CacheSize: 7680
L2CacheSpeed: None
Revision: None

Versions of relevant libraries:
[pip3] numpy==1.26.3
[pip3] torch==2.5.1+cpu
[pip3] torchaudio==2.5.1+cpu
[pip3] torchvision==0.20.1+cpu
[conda] numpy                     1.26.3                   pypi_0    pypi
[conda] torch                     2.5.1+cpu                pypi_0    pypi
[conda] torchaudio                2.5.1+cpu                pypi_0    pypi
[conda] torchvision               0.20.1+cpu               pypi_0    pypi