Skip to content

Add FFT operator support to TFLM kernels #3263

@junseokShim

Description

@junseokShim

Hi TFLM team,

I work as a software engineer in the manufacturing industry,
mainly developing software for industrial/production systems.

In this domain we process a lot of time-series data on edge devices and MCUs
(e.g., vibration signals, power consumption patterns, etc.).
Many of these workloads would benefit from using frequency-domain features
directly on the device, instead of relying only on external pre-processing.

Because of this, I’d like to propose adding FFT support to TFLM.

Proposed functionality

I’m primarily interested in two operators:

  1. FFT: transform time-domain data into the frequency domain.
  2. IFFT: inverse transform from the frequency domain back to the time domain.

As a first step, I’m thinking of:

  • 1D FFT along the last axis (e.g., [batch, length][batch, length] in frequency space)
  • Real-valued input time-series, with a suitable representation for the complex output
    (for example, separate real/imag tensors or an interleaved layout)
  • A corresponding 1D IFFT with a clearly defined scaling/normalization rule.

Questions / design considerations

Before starting any implementation, I’d like to ask for guidance on a few points:

  1. Scope

    • Is it in scope for TFLM to add FFT / IFFT as builtin operators,
      or would you prefer this to live as a “composite / library” outside the core kernels?
  2. Data types and complex representation

    • TFLM doesn’t currently focus on complex tensor types.
      Would you prefer:
      • separate real / imag tensors,
      • or a specific real/imag packing scheme (e.g., 2-channel layout)?
  3. Signal length constraints

    • Should the initial implementation require power-of-two lengths,
      or is arbitrary length FFT expected?
    • Should zero-padding be handled inside the op or left to the model/pre-processing?
  4. Scaling / normalization

    • For IFFT, should the operator apply 1/N scaling internally, or leave it to the model?
  5. Implementation / third-party libraries

    • Is there a preferred way to integrate existing FFT implementations
      (e.g., via third_party libraries), or would you rather keep the kernel
      as a minimal, reference-style implementation?

If FFT / IFFT operators are considered in scope for TFLM, I would be happy to
help with the design and implementation, starting from a minimal 1D real-valued
FFT + IFFT and expanding based on your feedback.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions