Skip to content

[OpenVINO backend] Implements Fourier Transform operation istft()#22323

Merged
hertschuh merged 5 commits intokeras-team:masterfrom
goyaladitya05:openvino/istft
Mar 4, 2026
Merged

[OpenVINO backend] Implements Fourier Transform operation istft()#22323
hertschuh merged 5 commits intokeras-team:masterfrom
goyaladitya05:openvino/istft

Conversation

@goyaladitya05
Copy link
Contributor

Implements istft for the OpenVINO backend via a overlap and add approach using OpenVINO ops, mirroring the JAX/Torch reshape trick.

Added _overlap_sequences_ov helper that handles dynamic num_sequences via shape_of/gather ops.
Removed relevent tests from excluded_concrete_tests.txt.

Closes: openvinotoolkit/openvino/issues/34418

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the OpenVINO backend by providing a complete implementation of the Inverse Short-Time Fourier Transform (ISTFT) operation. This addition allows for the reconstruction of time-domain signals from their frequency-domain representations, mirroring established approaches in other backends like JAX and Torch. The implementation leverages OpenVINO's native operations for dynamic shape handling and efficient computation, making the backend more capable for audio and signal processing tasks.

Highlights

  • Inverse Short-Time Fourier Transform (ISTFT) Implementation: The istft operation has been fully implemented for the OpenVINO backend, replacing the previous NotImplementedError. This enables the inverse transformation of STFT results within the OpenVINO environment.
  • Overlap and Add Helper Function: A new helper function, _overlap_sequences_ov, was introduced to manage the overlap and add process crucial for istft. This function handles dynamic sequence numbers using OpenVINO's shape manipulation operations.
  • Test Suite Updates: Relevant istft tests were removed from excluded_concrete_tests.txt, indicating that the newly implemented istft functionality is now expected to pass these tests.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • keras/src/backend/openvino/excluded_concrete_tests.txt
    • Removed multiple MathOpsCorrectnessTest::test_istft entries, indicating the istft operation is now supported.
  • keras/src/backend/openvino/math.py
    • Added the _overlap_sequences_ov helper function to facilitate the overlap and add logic for ISTFT.
    • Implemented the istft function, including windowing, padding, inverse FFT, and dynamic shape handling using OpenVINO operations.
    • Replaced the NotImplementedError for istft with the full functional implementation.
Activity
  • No human activity has been recorded on this pull request since its creation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements the istft operation for the OpenVINO backend. The implementation includes a new helper function _overlap_sequences_ov to perform the overlap-and-add method using OpenVINO operations. The changes look good overall. I've added a couple of suggestions to improve the readability and maintainability of the new code, mainly by using more descriptive variable names, adding comments to a complex function, and replacing a magic number with a named constant.

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 89.58333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.91%. Comparing base (f02d82b) to head (9363303).

Files with missing lines Patch % Lines
keras/src/backend/openvino/math.py 89.58% 3 Missing and 7 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #22323   +/-   ##
=======================================
  Coverage   82.90%   82.91%           
=======================================
  Files         594      594           
  Lines       65844    65940   +96     
  Branches    10293    10310   +17     
=======================================
+ Hits        54590    54676   +86     
- Misses       8638     8641    +3     
- Partials     2616     2623    +7     
Flag Coverage Δ
keras 82.74% <89.58%> (+<0.01%) ⬆️
keras-jax 60.86% <2.08%> (-0.09%) ⬇️
keras-numpy 55.03% <0.00%> (-0.08%) ⬇️
keras-openvino 49.15% <89.58%> (+0.06%) ⬆️
keras-tensorflow 62.07% <2.08%> (-0.09%) ⬇️
keras-torch 60.93% <2.08%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@goyaladitya05 goyaladitya05 reopened this Mar 1, 2026
@goyaladitya05 goyaladitya05 force-pushed the openvino/istft branch 2 times, most recently from 319919e to 44bd192 Compare March 3, 2026 09:01
Copy link
Collaborator

@hertschuh hertschuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing these!

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Mar 4, 2026
@hertschuh hertschuh merged commit 56b095b into keras-team:master Mar 4, 2026
8 checks passed
@goyaladitya05 goyaladitya05 deleted the openvino/istft branch March 5, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kokoro:force-run ready to pull Ready to be merged into the codebase size:L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Keras 3 OpenVINO backend]: Implement support for Fourier Transform operation istft

4 participants