-
Notifications
You must be signed in to change notification settings - Fork 975
TFLM: Add ONE_HOT operator and unit tests #3260
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?
TFLM: Add ONE_HOT operator and unit tests #3260
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
@googlebot I signed it! |
26628b8 to
8ecac95
Compare
|
@junseokShim Please add a line at the end of your PR description above: |
|
@junseokShim This does not seem to be a completed PR. Please adhere to the requirements as listed in issue #3078. |
OK, I will double-check the detailed requirements and make sure they are reflected. |
| namespace tflite { | ||
| namespace ops { | ||
| namespace micro { | ||
| namespace one_hot { |
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 flatten the namespace to just 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.
Okay, I'll reflect it in the next commit.
| $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/zeros_like.cc | ||
| $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/zeros_like.cc \ | ||
| $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/one_hot.cc \ |
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.
new files should be in alphabetical order
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.
Okay, I'll reflect it in the next commit. too
| } | ||
| } | ||
|
|
||
| TfLiteStatus ResizeOutputTensor(TfLiteContext* context, |
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.
Method should have a name more representative of it's functionality.
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.
Okay, I'll fix the method in the next commit.
| expected_dim_i = op_context.indices->dims->data[i - 1]; | ||
| } | ||
|
|
||
| // If the size pre-allocated by the TFLM compiler (Offline Memory Planner) |
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.
Change Offline Memory Planner to just Memory Planner please. There are several memory planners.
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.
Okay, I'll change the memory planner.
| const TFLMRegistration* Register_ONE_HOT() { | ||
| static TFLMRegistration r = {}; | ||
|
|
||
| r.prepare = one_hot::Prepare; | ||
| r.invoke = one_hot::Eval; | ||
|
|
||
| return &r; | ||
| } |
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 follow the registration implementation of all other kernels.
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.
Okay, I will modify the registration implementation soon.
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.
Why is this file in the PR?
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's my mistake, I will remove this file at next PR.
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.
This file is not required. External declaration of the registration method is handled elsewhere in TFLM.
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.
okay. I will modify at next PR.
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.
Why is this file included in the PR?
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's my mistake, I will remove this file at next PR.
This PR adds ONE_HOT operator support to TensorFlow Lite Micro.
tensorflow/lite/micro/kernels/one_hot.cctensorflow/lite/micro/kernels/one_hot.htensorflow/lite/micro/one_hot_test.ccmake -f tensorflow/lite/micro/tools/make/Makefile test_one_hot_testclang-formatandcpplint.pyon modified filesThis intends to address #3078.
bug=fixes #3078