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

Add spec for UniformQuantizeOp #531

Closed
sdasgup3 opened this issue Nov 14, 2022 · 1 comment · Fixed by #1496
Closed

Add spec for UniformQuantizeOp #531

sdasgup3 opened this issue Nov 14, 2022 · 1 comment · Fixed by #1496
Assignees

Comments

@sdasgup3
Copy link
Member

Request description

To spec stablehlo.uniform_quantize

@burmako
Copy link
Contributor

burmako commented Nov 24, 2022

Will be handled as part of the quantization speccing effort (#588).

@burmako burmako closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
@burmako burmako reopened this Jan 27, 2023
@burmako burmako assigned subhankarshah and unassigned burmako Jan 27, 2023
@burmako burmako moved this to In Progress in Frontend contract Feb 19, 2023
sdasgup3 added a commit that referenced this issue Jun 19, 2023
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.
@github-project-automation github-project-automation bot moved this from In Progress to Done in Frontend contract Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants