Skip to content

Conversation

@tanmaydas82
Copy link
Contributor

@TFLM-bot TFLM-bot removed the ci:run label Mar 21, 2023
@tanmaydas82 tanmaydas82 marked this pull request as ready for review March 21, 2023 23:46
@tanmaydas82 tanmaydas82 requested a review from a team as a code owner March 21, 2023 23:46
@tanmaydas82 tanmaydas82 requested a review from advaitjain March 21, 2023 23:46
Copy link
Collaborator

@emmett-google emmett-google left a comment

Choose a reason for hiding this comment

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

Suggestion to move the check into CalculateOpDataAdd but otherwise looks good!

// This is to ensure that for int8/int16 output type,output does not have
// a "no-quantization" quantization type.
if (output->type == kTfLiteInt8 || output->type == kTfLiteInt16) {
TFLITE_CHECK_NE(output->quantization.type, kTfLiteNoQuantization);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest moving this into CalculateOpDataAdd in Line 42 for a few long term maintenance reasons:

  • The assert is closer to the code that assumes quantization.
  • One fewer branch to maintain for checking output types. If someone extends the branch logic in CalculateOpDataAdd, it will only need to be changed in on place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the suggestion! Made the change.

data->requires_broadcast = !HaveSameShapes(input1, input2);

if (output->type == kTfLiteInt8 || output->type == kTfLiteInt16) {
// This is to ensure that for int8/int16 output type,output does not have
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Remove the comment. It's basically explaining the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@mergify mergify bot merged commit 5e7ea29 into tensorflow:main Mar 27, 2023
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