apple / apple/coremltools

torch stft op conversion is broken for torch-2.7.0

Open
#2,504 1 comment 0 reactions 1 assignee Claimed by @TobyRoseman View on GitHub
bug
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

## 🐞Describing the bug
torch `stft` op conversion is broken due to torch op signature drift from torch-2.5.0 to torch-2.7.0 (coremltools warns that 2.5.0 is the latest tested version of torch for coremltools-8.3 so the quick workaround is to downgrade torch temporarily). To be clear [this exact line](https://github.com/apple/coremltools/blob/8.3/coremltools/converters/mil/frontend/torch/ops.py#L8455) surfaces the issue.

## Stack Trace

```
File ".../lib/python3.11/site-packages/coremltools/converters/mil/frontend/torch/ops.py", line 173, in convert_single_node
add_op(context, node)
File ".../lib/python3.11/site-packages/coremltools/converters/mil/frontend/torch/ops.py", line 8455, in stft
input_data, n_fft, hop_length, win_length, window, normalized, onesided, _ = _get_inputs(context, node, min_expected=2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 8)
```

## System environment (please complete the following information):
- coremltools version: 8.3
- OS (e.g. MacOS version or Linux type): macOS15
- PyTorch: 2.7.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.