Skip to content

[Relax][ONNX] Add cosine-sum window converters - #20819

Open
hiyufan wants to merge 1 commit into
apache:mainfrom
hiyufan:feat/onnx-window-functions-20124
Open

hiyufan wants to merge 1 commit into
apache:mainfrom
hiyufan:feat/onnx-window-functions-20124

Conversation

@hiyufan

@hiyufan hiyufan commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

The Relax ONNX frontend rejects HannWindow, HammingWindow and BlackmanWindow models. Add shared cosine-sum lowering using existing Relax operators and the existing tensor-to-shape helper for runtime lengths.

Support int32/int64 size inputs, initializer/runtime lengths, periodic/symmetric modes, the default float32 output and numeric output casts. Compute in float32, use ONNX's Hamming coefficients, and add the constant offset after the cosine terms to match native window-kernel rounding before integer casts. Validate the periodic attribute and positive initializer lengths.

Related to #20124 (these three window operators only).

Validation against main f0267a0a3e, Python 3.11, LLVM 21.1.8, and the CI-pinned ONNX 1.20.1 / ONNX Runtime 1.23.2:

  • All 120 added window tests passed across the matrix and dynamic-VM reuse runs. Coverage includes default/explicit periodic mode, initializer/runtime sizes, int32/int64 size dtypes, float16/float32/float64/int32 outputs, bfloat16 casts, lengths 1/2/7, invalid initializer lengths and invalid periodic values. Six reuse tests run the same compiled VM at lengths 1, 2, 7 and 10.
  • Values, shapes and dtypes are checked against ONNX Runtime. Bfloat16 outputs use its float32 result followed by an independent NumPy bfloat16 cast.
  • Adjacent Range tests: all 13 passed with the same pinned dependencies (133 passed in total).
  • File-scoped pre-commit checks passed.

Prepared with OpenAI Codex assistance. The LLVM build and validation above were executed locally using the pinned TIRx/FFI sources.

Fresh CI results are pending.

@hiyufan
hiyufan marked this pull request as ready for review October 25, 2026 11:27
@hiyufan
hiyufan force-pushed the feat/onnx-window-functions-20124 branch from fe37796 to 23832ef Compare November 15, 2026 02:51
@hiyufan
hiyufan force-pushed the feat/onnx-window-functions-20124 branch from 23832ef to 67cb4a6 Compare November 15, 2026 03:38
@hiyufan
hiyufan force-pushed the feat/onnx-window-functions-20124 branch from 67cb4a6 to b77ac30 Compare November 15, 2026 06:30

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant