-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Towards supporting quantized structured kernels #74560
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
Conversation
This PR add support for quantized tensors with "unknown quantizer", which means that we can use standard APIs like torch.empty to allocate quantized tensors, with the understanding that we will set the quantizer later. This makes meta functions applicable to quantized tensors (they will allocate with unknown quantizer and the kernel will set the quantizer later) and fixes a bug David Dang reported where structured kernels give a weird error message when you call them with quantized inputs. This is not a complete support for quantized structured kernels because I haven't actually tried porting any of the quantized implementations to structured; qadd is probably a good choice to try first as it does its broadcasting implementation using TensorIterator. My goal here is just to show that the error message is better. See also #52680 Signed-off-by: Edward Z. Yang <ezyang@fb.com> [ghstack-poisoned]
This PR add support for quantized tensors with "unknown quantizer", which means that we can use standard APIs like torch.empty to allocate quantized tensors, with the understanding that we will set the quantizer later. This makes meta functions applicable to quantized tensors (they will allocate with unknown quantizer and the kernel will set the quantizer later) and fixes a bug David Dang reported where structured kernels give a weird error message when you call them with quantized inputs. This is not a complete support for quantized structured kernels because I haven't actually tried porting any of the quantized implementations to structured; qadd is probably a good choice to try first as it does its broadcasting implementation using TensorIterator. My goal here is just to show that the error message is better. See also #52680 Signed-off-by: Edward Z. Yang <ezyangfb.com> ghstack-source-id: aa7272d Pull Request resolved: #74560
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 5a934fd (more details on the Dr. CI page):
🕵️♀️ 18 failures not recognized by patterns:The following CI failures may be due to changes from the PR
This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
| runtime_empty_supported_check = "" | ||
| elif backend_index.dispatch_key == DispatchKey.CompositeExplicitAutograd: | ||
| elif backend_index.dispatch_key in ( | ||
| DispatchKey.CompositeExplicitAutograd, DispatchKey.QuantizedCPU, DispatchKey.QuantizedCUDA): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit if we care about the perf (probably not necessary, just calling it out): we could avoid the dispatcher hop here from calling at::empty, but we'd have to abide by the naming convention and name the native kernels at::native::empty_quantizedcpu/cuda
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh this used to not be easy to do but now it is easy
| empty_impl = "at::empty" | ||
| empty_strided_impl = "at::empty_strided" | ||
| runtime_empty_supported_check = """\ | ||
| if (!c10::detail::backend_supports_empty_operator(options)) {{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for killing this :')
| r"Registration to both CompositeImplicitAutograd and CompositeExplicitAutograd is not allowed"): | ||
| dispatcher.register(["CompositeExplicitAutograd", "CompositeImplicitAutograd"]) | ||
|
|
||
| def test_quantized_structured_not_implemented(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test in https://github.com/pytorch/pytorch/blob/master/test/quantization/core/test_quantized_tensor.py#L142 for calling some methods (e.g. qscheme) on an unknown tensor as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
jerryzh168
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
followups are non-blocking, will accept first
|
@pytorchbot merge this |
|
Merge failed due to Matched rule superuser, but it was not reviewed yet by any of:pbelevich,H-Huang,albanD,hlu1,jamesr66a, ... |
This PR add support for quantized tensors with "unknown quantizer", which means that we can use standard APIs like torch.empty to allocate quantized tensors, with the understanding that we will set the quantizer later. This makes meta functions applicable to quantized tensors (they will allocate with unknown quantizer and the kernel will set the quantizer later) and fixes a bug David Dang reported where structured kernels give a weird error message when you call them with quantized inputs. This is not a complete support for quantized structured kernels because I haven't actually tried porting any of the quantized implementations to structured; qadd is probably a good choice to try first as it does its broadcasting implementation using TensorIterator. My goal here is just to show that the error message is better. See also #52680 Signed-off-by: Edward Z. Yang <ezyangfb.com> [ghstack-poisoned]
|
@dzdang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: #74560 This PR add support for quantized tensors with "unknown quantizer", which means that we can use standard APIs like torch.empty to allocate quantized tensors, with the understanding that we will set the quantizer later. This makes meta functions applicable to quantized tensors (they will allocate with unknown quantizer and the kernel will set the quantizer later) and fixes a bug David Dang reported where structured kernels give a weird error message when you call them with quantized inputs. This is not a complete support for quantized structured kernels because I haven't actually tried porting any of the quantized implementations to structured; qadd is probably a good choice to try first as it does its broadcasting implementation using TensorIterator. My goal here is just to show that the error message is better. See also #52680 Signed-off-by: Edward Z. Yang <ezyangfb.com> Test Plan: Imported from OSS Reviewed By: mruberry Differential Revision: D35317441 Pulled By: dzdang fbshipit-source-id: ffb85b0e06ccbcc2b01052ca6760517684048b39
|
Hey @ezyang. |
…tion_pad1d_quantized_cpu and" Summary: With the introduction of structured kernel support for quantized tensors in #74560, we are able to remove the dimension and output resizing code in reflection_pad1d_out_template (this code already present in reflection_pad1d), as well as the implementation for reflection_pad1d_quantized_cpu. This PR should introduce no functional changes. Test plan: ``` python run_test.py ``` Differential Revision: [D35148152](https://our.internmc.facebook.com/intern/diff/D35148152) [ghstack-poisoned]
…ized_cpu and" Summary: With the introduction of structured kernel support for quantized tensors in #74560, we are able to remove the dimension and output resizing code in reflection_pad1d_out_template (this code already present in reflection_pad1d), as well as the implementation for reflection_pad1d_quantized_cpu. This PR should introduce no functional changes. Test plan: ``` python run_test.py ``` Differential Revision: [D35148152](https://our.internmc.facebook.com/intern/diff/D35148152) [ghstack-poisoned]
…tion_pad1d_quantized_cpu, dimension and output resizing code in reflection_pad1d_out_template and implemented reflection_pad1d_out_quantized_cpu" Summary: With the introduction of structured kernel support for quantized tensors in #74560, we are able to remove the dimension and output resizing code in reflection_pad1d_out_template. This code is already present in reflection_pad1d. reflection_pad1d_quantized_cpu has also been removed as quantized tensors can now use reflection_pad1d after the changes in the linked PR. reflection_pad1d_out_quantized_cpu was implemented for quantized tensors. This PR should introduce no functional changes. Test plan: ``` python run_test.py ``` Differential Revision: [D35148152](https://our.internmc.facebook.com/intern/diff/D35148152) [ghstack-poisoned]
…ized_cpu, dimension and output resizing code in reflection_pad1d_out_template and implemented reflection_pad1d_out_quantized_cpu" Summary: With the introduction of structured kernel support for quantized tensors in #74560, we are able to remove the dimension and output resizing code in reflection_pad1d_out_template. This code is already present in reflection_pad1d. reflection_pad1d_quantized_cpu has also been removed as quantized tensors can now use reflection_pad1d after the changes in the linked PR. reflection_pad1d_out_quantized_cpu was implemented for quantized tensors. This PR should introduce no functional changes. Test plan: ``` python run_test.py ``` Differential Revision: [D35148152](https://our.internmc.facebook.com/intern/diff/D35148152) [ghstack-poisoned]
…tch registration for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
… for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
…tch registration for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
… for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
…tch registration for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
… for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
…tch registration for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
… for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
…tch registration for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
…tch registration for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
… for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
… for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
…tch registration for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
… for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
…tch registration for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
… for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
…tch registration for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
…tch registration for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
… for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
… for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
…tch registration for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
…tch registration for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
… for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
… for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
…tch registration for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
…tch registration for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
… for max_pool2d & quantized_max_pool2d and implemented max_pool2d_with_indices_out_quantized_cpu" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool2d, and implements a quantized kernel for max_pool2d_with_indices. This PR also introduces isnan() support for vectorized int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors. Test plan: ``` python test/test_quantization.py -k test_max_pool2d ``` Differential Revision: [D35420901](https://our.internmc.facebook.com/intern/diff/D35420901) [ghstack-poisoned]
… for max_pool1d & quantized_max_pool1d" Summary: This PR is part of a series of PRs addressing #54150, related to using dispatcher for calls to quantized backends as opposed to if/else conditionals. This particular PR removes the is_quantized check from max_pool1d and modifies max_pool1d_impl to be compatible with int tensors. This PR relies on #74560, which introduces structured kernel support for quantized tensors and #72353. Test plan: ``` python test/test_quantization.py -k test_max_pool1d ``` Differential Revision: [D35431831](https://our.internmc.facebook.com/intern/diff/D35431831) [ghstack-poisoned]
Stack from ghstack (oldest at bottom):
This PR add support for quantized tensors with "unknown quantizer",
which means that we can use standard APIs like torch.empty to allocate
quantized tensors, with the understanding that we will set the
quantizer later. This makes meta functions applicable to quantized
tensors (they will allocate with unknown quantizer and the kernel
will set the quantizer later) and fixes a bug David Dang reported
where structured kernels give a weird error message when you call them
with quantized inputs.
This is not a complete support for quantized structured kernels because
I haven't actually tried porting any of the quantized implementations
to structured; qadd is probably a good choice to try first as it
does its broadcasting implementation using TensorIterator. My goal
here is just to show that the error message is better.
See also #52680
Signed-off-by: Edward Z. Yang <ezyangfb.com>
Differential Revision: D35317441