Skip to content

Conversation

@shlmregev
Copy link
Member

This change includes the RFFT kernel header, making the RFFT operation specialized for different types (int16 etc.) available for use in TFLite Micro models via the MicroMutableOpResolver.

BUG=315941833

This change includes the RFFT kernel header, making the RFFT operation specialized for different types (int16 etc.) available for use in TFLite Micro models via the MicroMutableOpResolver.
@shlmregev shlmregev requested a review from a team as a code owner December 9, 2025 17:39
@TFLM-bot TFLM-bot removed the ci:run label Dec 9, 2025
@ddavis-2015
Copy link
Member

@shlmregev @veblush I am confused by this PR change. Could not the application developer have included signal/micro/kernels/rfft.h in their own code, and then called AddRfft with the registration of their choice?

@shlmregev
Copy link
Member Author

@shlmregev @veblush I am confused by this PR change. Could not the application developer have included signal/micro/kernels/rfft.h in their own code, and then called AddRfft with the registration of their choice?

The visibility for register_signal_ops is limited to "//tensorflow/lite/micro" and that's the only rule that exposes this header.
It look like including the header in micro_mutable_op_resolver.h is the preferred way of doing this.

#include <cstdio>
#include <cstring>

#include "signal/micro/kernels/rfft.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the standard approach here is to add the register functions to

namespace tflm_signal {
TFLMRegistration* Register_DELAY();
TFLMRegistration* Register_FFT_AUTO_SCALE();
TFLMRegistration* Register_FILTER_BANK();
TFLMRegistration* Register_FILTER_BANK_LOG();
TFLMRegistration* Register_FILTER_BANK_SPECTRAL_SUBTRACTION();
TFLMRegistration* Register_FILTER_BANK_SQUARE_ROOT();
TFLMRegistration* Register_ENERGY();
TFLMRegistration* Register_FRAMER();
TFLMRegistration* Register_OVERLAP_ADD();
TFLMRegistration* Register_PCAN();
TFLMRegistration* Register_STACKER();
TFLMRegistration* Register_WINDOW();
} // namespace tflm_signal
instead of including new headers.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason why I need to include this file, is so that I can do this:
AddRfft(::tflite::tflm_signal::Register_RFFT_INT16());

Should I add ::tflite::tflm_signal::Register_RFFT_INT16() to micro_ops.h?

micro_ops.h doesn't define any other Register_ function for specialized types. And looking at tensorflow/lite/micro/micro_mutable_op_resolver.h, there are multiple kernel headers included there, presumably for the same purpose.

Copy link
Member

Choose a reason for hiding this comment

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

@shlmregev @veblush Ah, I understand now. This is how CONV_2D, FULLY_CONNECTED, MUL, etc. expose their additional registrations as well. So micro_mutable_op_resolver.h is the right place to put the include. I'm thinking that signal/micro/kernels/irfft.h should also be included here, as it also has multiple registrations.

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.

4 participants