Skip to content

Commit

Permalink
added an example of uniform_quantize with quantized operand
Browse files Browse the repository at this point in the history
  • Loading branch information
sdasgup3 committed Jun 4, 2023
1 parent 14eef28 commit 340f968
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -5612,12 +5612,8 @@ Formally, `result = (operand - zero_point(operand)) * scale(operand)`.
#### Examples

```mlir
// %operand: 10
%result = "stablehlo.uniform_dequantize"(%operand) : (tensor<!quant.uniform<i8<-128:127>:f32, 0.5:-20>>) -> tensor<f32>
// %result: 15.0
// %operand: [10, 10]
%result = "stablehlo.uniform_dequantize"(%operand) : (tensor<3x!quant.uniform<i8<-128:127>:f32:0, {0.1:-30, 0.5:-20}>>) -> tensor<3xf32>
%result = "stablehlo.uniform_dequantize"(%operand) : (tensor<2x!quant.uniform<i8<-128:127>:f32:0, {0.1:-30, 0.5:-20}>>) -> tensor<2xf32>
// %result: [4.0, 15.0]
```

Expand Down Expand Up @@ -5663,12 +5659,12 @@ Formally,
#### Examples

```mlir
// %operand: 15.0
%result = "stablehlo.uniform_quantize"(%operand) : (tensor<f32>) -> tensor<!quant.uniform<i8<-128:127>:f32, 0.5:-20>>
// %result: 10
// %operand: [4.0, 15.0]
%result = "stablehlo.uniform_quantize"(%operand) : (tensor<3xf32>) -> tensor<3x!quant.uniform<i8<-128:127>:f32:0, {0.1:-30, 0.5:-20}>>
%result = "stablehlo.uniform_quantize"(%operand) : (tensor<2xf32>) -> tensor<2x!quant.uniform<i8<-128:127>:f32:0, {0.1:-30, 0.5:-20}>>
// %result: [10, 10]
// %operand: [10, 10]
%result = "stablehlo.uniform_quantize"(%operand) : (tensor<2x!quant.uniform<i8<-128:127>:f32:0, {0.1:-30, 0.5:-20}>>) -> tensor<2x!quant.uniform<i8<-128:127>:f32:0, {0.1:-30, 0.5:-20}>>
// %result: [10, 10]
```

Expand Down

0 comments on commit 340f968

Please sign in to comment.