mlearning/tflite-micro: Register DEPTHWISE_CONV_2D in tflm_tool resolver. - #3773
Merged
Merged
Conversation
…ver. MicroMutableOpResolver<8> only registered 8 ops, missing DEPTHWISE_CONV_2D, required by any depthwise-separable CNN (MobileNet-style, DS-CNN keyword-spotting models). The kernel already exists upstream (Register_DEPTHWISE_CONV_2D_INT8() in tensorflow/lite/micro/kernels/depthwise_conv.h); this wires it into the resolver and bumps the template size to <9>. Verified with micro_speech_quantized.tflite on sim:tflm. Before: Didn't find op for builtin opcode 'DEPTHWISE_CONV_2D'. After: RESHAPE/DEPTHWISE_CONV_2D/FULLY_CONNECTED/SOFTMAX all execute. Signed-off-by: Ansh Rai <anshrai331@gmail.com>
xiaoxiang781216
approved these changes
Sep 6, 2026
jerpelea
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Impact
Testing
I confirm that changes are verified on local setup and works as intended:
Test model: micro_speech_quantized.tflite (from tensorflow/tflite-micro's own examples repo), which uses RESHAPE, DEPTHWISE_CONV_2D, FULLY_CONNECTED, SOFTMAX.
Before change:
nsh> tflm -i /data/micro_speech_quantized.tflite -o /data/out.cc -E -a 20000
Didn't find op for builtin opcode 'DEPTHWISE_CONV_2D'
Failed to get registration from op code DEPTHWISE_CONV_2D
"Event","Tag","Ticks"
"Unique Tag","Total ticks across all events with that tag."
"total number of ticks", 0
nxai done!
After change:
nsh> tflm -i /data/micro_speech_quantized.tflite -o /data/out.cc -E -a 20000
0 (id=0): size=4000, offset=0, first_used=2 last_used=3
1 (id=1): size=1968, offset=0, first_used=0 last_used=1
2 (id=2): size=1968, offset=4000, first_used=1 last_used=2
3 (id=3): size=16, offset=4000, first_used=3 last_used=4
4 (id=4): size=16, offset=0, first_used=4 last_used=4
0: 11111111111111111111111111...................................................... (2k)
1: 11111111111111111111111111...........................222222222222222222222222222 (4k)
2: 00000000000000000000000000000000000000000000000000000222222222222222222222222222 (6k)
3: 00000000000000000000000000000000000000000000000000000........................... (4k)
4: ................................................................................ (1k)
"Event","Tag","Ticks"
0,RESHAPE,0
1,DEPTHWISE_CONV_2D,0
2,FULLY_CONNECTED,0
3,SOFTMAX,0
"Unique Tag","Total ticks across all events with that tag."
RESHAPE, 0
DEPTHWISE_CONV_2D, 0
FULLY_CONNECTED, 0
SOFTMAX, 0
"total number of ticks", 0
nxai done!
PR verification Self-Check