[quant] Implement unsqueeze/squeeze for per-channel qtensor#38247
[quant] Implement unsqueeze/squeeze for per-channel qtensor#38247supriyar wants to merge 6 commits intogh/supriyar/111/basefrom
Conversation
Summary: Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim Test Plan: python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 3e39f54 (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis 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. This comment has been revised 16 times. |
Summary: Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim Test Plan: python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim Test Plan: python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
| namedinference::propagate_names_except(result, self, {dim}); | ||
| return result; | ||
| } | ||
|
|
There was a problem hiding this comment.
Should we also add support for squeeze with no dimensions specified?
raghuramank100
left a comment
There was a problem hiding this comment.
Looks good, a few suggestions to add more coverage
Summary: Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim Test Plan: python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
| return sum_to(self, size); | ||
| } | ||
|
|
||
| Tensor make_qtensor(const Tensor& self, IntArrayRef size, IntArrayRef stride, QuantizerPtr quantizer) { |
There was a problem hiding this comment.
I think you can define a new as_strided_qtensorimpl and remove the current as_strided_qtensorimpl
Summary: Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim Test Plan: python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
jerryzh168
left a comment
There was a problem hiding this comment.
please make make_qtensor a native function and remove as_strided_qtensorimpl
@jerryzh168 |
|
Sure, but then could you create an issue, or add a TODO to reflect the plan? |
jerryzh168
left a comment
There was a problem hiding this comment.
need follow up PR to change the API of as_strided_qtensorimpl
Summary: Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim Test Plan: python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
|
This pull request has been merged in b90fc52. |
…38247) Summary: Pull Request resolved: pytorch#38247 Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim Test Plan: python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze Imported from OSS Differential Revision: D21550293 fbshipit-source-id: 90ea4a1bd637588360b3228cb5af9176176eb033
Stack from ghstack:
Summary:
Per-channel quantized tensor axis value is shifted based on the unsqueeze/squeeze dim
Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_qtensor_unsqueze
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D21550293