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

[quant] Make choose_qparams_optimized return Tensors to preserve dtype #45530

Closed
wants to merge 4 commits into from

Conversation

supriyar
Copy link
Contributor

@supriyar supriyar commented Sep 29, 2020

Stack from ghstack:

Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D24001134

Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
supriyar added a commit that referenced this pull request Sep 29, 2020
Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: f315abb513eccf7f48f5720d07cc05cb18c5b712
Pull Request resolved: #45530
@dr-ci
Copy link

dr-ci bot commented Sep 29, 2020

💊 CI failures summary and remediations

As of commit 29e0d1c (more details on the Dr. CI page):



🚧 1 fixed upstream failure:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

Since your merge base is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

Check out the recency history of this "viable master" tracking branch.


ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 12 times.

…eserve dtype"

Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D24001134](https://our.internmc.facebook.com/intern/diff/D24001134)

[ghstack-poisoned]
supriyar added a commit that referenced this pull request Sep 29, 2020
Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 807667faa1012387a82ef710ea63dc833071073c
Pull Request resolved: #45530
…eserve dtype"

Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D24001134](https://our.internmc.facebook.com/intern/diff/D24001134)

[ghstack-poisoned]
supriyar added a commit that referenced this pull request Sep 29, 2020
Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 541687ce1372c1634f2fcaed64735a3ad073015f
Pull Request resolved: #45530
@@ -4437,7 +4437,7 @@
use_c10_dispatcher: full
variants: function

- func: choose_qparams_optimized(Tensor input, int numel, int n_bins, float ratio, int bit_width) -> (float, float)
- func: choose_qparams_optimized(Tensor input, int numel, int n_bins, float ratio, int bit_width) -> (Tensor, Tensor)
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering the reason for having numel as an argument? Isn't it the same as input tensor size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not necessarily, it could be per-channel in which case it will be numel per channel

…eserve dtype"

Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D24001134](https://our.internmc.facebook.com/intern/diff/D24001134)

[ghstack-poisoned]
supriyar added a commit that referenced this pull request Sep 30, 2020
Summary:
Returning double values requires special handling as a return type for aten functions.
Instead return tensors where the type is preserved in the tensor dtype

Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_choose_qparams_optimized

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 5077038980439051616348549ef5958654c23860
Pull Request resolved: #45530
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in c112e89.

@facebook-github-bot facebook-github-bot deleted the gh/supriyar/188/head branch October 4, 2020 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants