diff --git a/docs/spec.md b/docs/spec.md index 1b652c410a9..0a6ef1181fe 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -5612,9 +5612,13 @@ Formally, `result = (operand - zero_point(operand)) * scale(operand)`. #### Examples ```mlir -// %operand: 20 +// %operand: 10 %result = "stablehlo.uniform_dequantize"(%operand) : (tensor:f32, 0.5:-20>>) -> tensor -// %result: 20.0 +// %result: 15.0 + +// %operand: [10, 10] +%result = "stablehlo.uniform_dequantize"(%operand) : (tensor<3x!quant.uniform:f32:0, {0.1:-30, 0.5:-20}>>) -> tensor<3xf32> +// %result: [4.0, 15.0] ``` ### uniform_quantize @@ -5644,8 +5648,8 @@ Formally, #### Outputs -| Name | Type | Constraints | -|----------|--------------------------|------------------| +| Name | Type | Constraints | +|----------|------------------|------------------| | `result` | quantized tensor | (C1), (C2), (C3) | #### Constraints @@ -5653,16 +5657,19 @@ Formally, * (C1) If `element_type(operand)` is a floating-point type, * `element_type(operand) = expressed_type(result)`. * (C2) If `element_type(operand)` is a quantized type, - * `num_bits(storage_type(operand)) >= num_bits(storage_type(result))`. * `expressed_type(operand) = expressed_type(result)`. * (C3) `shape(operand) = shape(result)`. #### Examples ```mlir -// %operand: 20.0 +// %operand: 15.0 %result = "stablehlo.uniform_quantize"(%operand) : (tensor) -> tensor:f32, 0.5:-20>> -// %result: 20 +// %result: 10 + +// %operand: [4.0, 15.0] +%result = "stablehlo.uniform_quantize"(%operand) : (tensor<3xf32>) -> tensor<3x!quant.uniform:f32:0, {0.1:-30, 0.5:-20}>> +// %result: [10, 10] ``` ### while