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

[Frontend][TFLite] Dynamically calculate input_stats of any fake_quant range #4789

Merged
merged 2 commits into from
Feb 5, 2020

Conversation

inadob
Copy link
Contributor

@inadob inadob commented Jan 29, 2020

  • pass the input range to the convertor and caclulate (mean, scale) there
  • change the range of the second tensor in elemwise operations
    so that we test inputs with different quant params
  • change the possible output range for elemwise ops wrt the updated ranges
  • update the comments for (m, s) calculations
  • add input range dict to tflite reduce_mean operation

* pass the input range to the convertor and caclulate (mean, scale) there
* change the range of the second tensor in elemwise operations
  so that we test inputs with different quant params
* change the possible output range for elemwise ops wrt the updated ranges
* update the comments for (m, s) calculations
* add input range dict to reduce_mean op
@inadob
Copy link
Contributor Author

inadob commented Jan 29, 2020

@kevinthesun @anijain2305 can you please take a look

Copy link
Contributor

@anijain2305 anijain2305 left a comment

Choose a reason for hiding this comment

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

Overall LGTM

Sorry for the late review.

tests/python/frontend/tflite/test_forward.py Outdated Show resolved Hide resolved
Copy link
Contributor

@wyc-ruiker wyc-ruiker left a comment

Choose a reason for hiding this comment

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

LGTM, please merge this pr first before #4805 and #4696.

Copy link
Contributor

@anijain2305 anijain2305 left a comment

Choose a reason for hiding this comment

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

LGTM

@kevinthesun Can this be merged?

Edit - @inadob Seems like your newly added assertion is getting triggered. Can you please fix it?

* add exception handling for zero division in input_stats
* fix range of the input tensor in elemwsie
Copy link
Contributor

@kevinthesun kevinthesun left a comment

Choose a reason for hiding this comment

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

LGTM

@kevinthesun kevinthesun merged commit 2989d72 into apache:master Feb 5, 2020
@kevinthesun
Copy link
Contributor

Thanks @inadob @wyc-ruiker @anijain2305

alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 26, 2020
…t range (apache#4789)

* [TFLite] Dynamically calculate input_stats of any fake_quant range

* pass the input range to the convertor and caclulate (mean, scale) there
* change the range of the second tensor in elemwise operations
  so that we test inputs with different quant params
* change the possible output range for elemwise ops wrt the updated ranges
* update the comments for (m, s) calculations
* add input range dict to reduce_mean op

* Apply requested changes

* add exception handling for zero division in input_stats
* fix range of the input tensor in elemwsie
alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 28, 2020
…t range (apache#4789)

* [TFLite] Dynamically calculate input_stats of any fake_quant range

* pass the input range to the convertor and caclulate (mean, scale) there
* change the range of the second tensor in elemwise operations
  so that we test inputs with different quant params
* change the possible output range for elemwise ops wrt the updated ranges
* update the comments for (m, s) calculations
* add input range dict to reduce_mean op

* Apply requested changes

* add exception handling for zero division in input_stats
* fix range of the input tensor in elemwsie
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2020
…t range (apache#4789)

* [TFLite] Dynamically calculate input_stats of any fake_quant range

* pass the input range to the convertor and caclulate (mean, scale) there
* change the range of the second tensor in elemwise operations
  so that we test inputs with different quant params
* change the possible output range for elemwise ops wrt the updated ranges
* update the comments for (m, s) calculations
* add input range dict to reduce_mean op

* Apply requested changes

* add exception handling for zero division in input_stats
* fix range of the input tensor in elemwsie
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