Skip to content
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

[TFLite 16x8] ADD/SUB operators: fixes + tests for versioning #42373

Merged
merged 4 commits into from Jan 12, 2021

Conversation

wwwind
Copy link
Contributor

@wwwind wwwind commented Aug 14, 2020

In this PR:

  • tests for versioning of operators ADD/SUB
  • some fixes:
    maximum version of ADD has been changed to 3 for 16x8, so I updated places, where it is mentioned as 4
    both inputs for SUB operator should be quantized to int16 as for it is done for ADD
  • as discussed: only general case of reference kernel for 16x8 SUB/ADD will be used for the new models
    It has been suggested to modify quantize_model.cc file and set option pot_scale_int16 to false during quantization - implementation is done this way.

…se + tests for versioning.

Change-Id: Ib24a2c2b837eaeb4868afdf1445aa332965a41af
@google-ml-butler google-ml-butler bot added the size:M CL Change Size: Medium label Aug 14, 2020
@gbaned gbaned self-assigned this Aug 15, 2020
@gbaned gbaned added the comp:lite TF Lite related issues label Aug 15, 2020
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Aug 15, 2020
@gbaned gbaned requested a review from petewarden August 15, 2020 06:02
@gbaned gbaned added the awaiting review Pull request awaiting review label Aug 19, 2020
@jdduke jdduke requested a review from suharshs August 19, 2020 15:48
- POT int16x8: create a new BroadcastSub16POTSlow function to manage the POT scaling.
- General int16x8: the BroadcastAdd4DSlow should be used instead of BroadcastSubSlow as the sign of input2 multiplier is changed in PrepareGeneralSubOp.

Change-Id: Id8042d089af51f402cba72b1db9bb5d948ba5cbc
@suharshs suharshs requested review from daverim and jianlijianli and removed request for suharshs September 29, 2020 15:23
@@ -913,6 +913,7 @@ OperatorProperty GetOperatorProperty(const ModelT* model, int subgraph_index,
property.inputs = {{0, {}}, {1, {}}};
property.outputs = {{0, {}}};
property.version = 2;
property.restrict_same_input_output_scale = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

The properties for ADD and SUB ops are different. Is it intended? What is the reason for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting! corrected

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you

@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Oct 4, 2020
@gbaned
Copy link
Contributor

gbaned commented Oct 6, 2020

@wwwind Can you please take a look on the above comment from @akarmi. Thanks!

@gbaned gbaned added the stat:awaiting response Status - Awaiting response from author label Oct 6, 2020
Change-Id: I0ddc0cd4db9604d3e84f5ce55ecbf8acc55c08d0
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Oct 6, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Oct 6, 2020
@gbaned gbaned removed the ready to pull PR ready for merge process label Oct 7, 2020
@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Oct 9, 2020
@gbaned gbaned added stat:awaiting response Status - Awaiting response from author awaiting review Pull request awaiting review and removed stat:awaiting response Status - Awaiting response from author labels Oct 9, 2020
Change-Id: Ia7f43fe9d77596e6ba9ff85d9776b94440362b0a
@fredrec fredrec self-requested a review November 2, 2020 12:28
@fredrec fredrec self-assigned this Nov 2, 2020
float GetTolerance(float min, float max) {
float kQuantizedStep = (max - min) / (std::numeric_limits<T>::max() -
std::numeric_limits<T>::min());
return 2.0 * kQuantizedStep;
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does the 2.0 come from ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @fredrec Thanks for the review.

Tolerance should be 2 quantized steps for the result:
a_float = a_int16 +- quantized_step
if i do difference, then upper bound is 2*quantized_step.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fredrec Can you please take a look on above comments from @wwwind. Thanks!

@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Nov 20, 2020
@gbaned gbaned added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Dec 4, 2020
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Dec 15, 2020
PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Dec 15, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Dec 15, 2020
@gbaned gbaned added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Dec 16, 2020
@gbaned gbaned added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Dec 31, 2020
@copybara-service copybara-service bot merged commit d387e6a into tensorflow:master Jan 12, 2021
PR Queue automation moved this from Approved by Reviewer to Merged Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:lite TF Lite related issues ready to pull PR ready for merge process size:M CL Change Size: Medium
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

7 participants