-
Notifications
You must be signed in to change notification settings - Fork 944
Support for DECODE operator #3132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@tensorflow/micro Add initial support for DECODE operator. Add reference implementation. Add LUT decompression support. Update op resolvers. Update Makefiles and Bazel BUILD files. Add kernel unit test. bug=fixes tensorflow#3131
…em). Cleanup unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This looks great, I've just left a few minor suggestions.
|
||
namespace tflite { | ||
|
||
struct DecodeState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to class per https://google.github.io/styleguide/cppguide.html#Structs_vs._Classes
|
||
namespace tflite { | ||
|
||
struct DecodeStateLUT : public DecodeState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename this to DecodeStateLut
per https://google.github.io/styleguide/cppguide.html#General_Naming_Rules
#include "tensorflow/lite/micro/micro_profiler_interface.h" | ||
|
||
namespace tflite { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about converting DecodeState into an interface called IDecodeAlgorithm? This would clarify its role, and we could then reorganize the helper functions into a separate container class.
@@ -0,0 +1,344 @@ | |||
/* Copyright 2025 The TensorFlow Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be clearer if we split this into separate tests, with each one focused on a specific algorithm?
}; | ||
|
||
// Align the tensor data the same as a Buffer in the TfLite schema | ||
alignas(16) const uint8_t kEncodedLUT[] = {0x1B, 0xE4}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be useful to have a comment as to how this is constructed.
count -= 1; | ||
} | ||
|
||
// process elements in current channel in groups of 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why 16 instead of 8?
@@ -0,0 +1,344 @@ | |||
/* Copyright 2025 The TensorFlow Authors. All Rights Reserved. | |||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LUT has many combinations to cover. Then, do you have a plan to expand the coverage a bit?
@tensorflow/micro
Add initial support for DECODE operator.
Add reference implementation.
Add LUT decompression support.
Update op resolvers.
Update Makefiles and Bazel BUILD files.
Add kernel unit test.
bug=fixes #3131