-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Specification for UniformQuantizeOp and UniformDequantizeOp (#1496)
fixes #531 fixes #530 ## Summary The PR proposes the specification for `uniform.quantize` and `uniform.dequantize` ops. The specification of `uniform.quantize` also captures the re-quantization conversions from quantized tensor to quantized tensors. Please let me know your feedback. ### Working notes on following the `reference_checklist.md` and `spec_checkilist.md` #### uniform_dequantize We have the following constraints from the spec ``` (I1) `operand` is a quantized tensor (C1) `shape(operand) = shape(result)`. (C2) `element_type(result) = expressed_type(operand)`. ``` These constraints will be comprehensively covered by the following tests: ``` I1: a) `operand: quantized tensors`. (Covered by ODS). C1: a) `shape(operand) != shape(result)`. (Covered by ODS) C2: a) `element_type(result) != expressed_type(operand)`. ``` If we drop the "Covered by ODS" pieces, this will leave us with the following test cases: ``` C2: a) `element_type(result) != expressed_type(operand)`. ``` We already has a type inference test to cover the above. #### uniform_quantize We have the following constraints from the spec ``` (I1) `operand: tensor of floating-point or quantized type`. (C1) `shape(operand) = shape(result)`. (C2) `expressed_type(result) = is_float(operand) ? element_type(operand) : expressed_type(operand)`. ``` These constraints will be comprehensively covered by the following tests: ``` I1: a) `operand: quantized tensors`. (Covered by ODS). C1: a) `shape(operand) != shape(result)`. (Covered by ODS) C2: a) if_float(operand): `expressed_type(result) != element_type(operand)`. b) if_quantized(operand): `expressed_type(result) != expressed_type(operand)`. ``` If we drop the "Covered by ODS" pieces, this will leave us with the following test cases: ``` C2: a) if_float(operand): `expressed_type(result) != element_type(operand)`. b) if_quantized(operand): `expressed_type(result) != expressed_type(operand)`. ``` The above will be covered as part of #1603.
- Loading branch information
Showing
6 changed files
with
143 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters