QuantizeLinear - 10 vs 13¶
QuantizeLinear10 → QuantizeLinear13
RENAMED
@@ -1 +1 @@
|
|
1
|
-
The linear
|
1
|
+
The linear quantization operator. It consumes a high precision tensor, a scale, and a zero point to compute the low precision / quantized tensor.
|
2
|
+
The scale factor and zero point must have same shape, and can be either a scalar for per-tensor / per layer quantization, or a 1-D tensor for per-axis quantization.
|
3
|
+
The quantization formula is y = saturate ((x / y_scale) + y_zero_point).
|
2
|
-
|
4
|
+
For saturation, it saturates to [0, 255] if it's uint8, or [-128, 127] if it's int8.
|
3
5
|
For (x / y_scale), it's rounding to nearest ties to even. Refer to https://en.wikipedia.org/wiki/Rounding for details. 'y_zero_point' and 'y' must have same type.
|
6
|
+
|
7
|
+
**Attributes**
|
8
|
+
|
9
|
+
* **axis**:
|
10
|
+
(Optional) The axis of the quantization dimension of the input
|
11
|
+
tensor. Ignored for per-tensor quantization. Negative value means
|
12
|
+
counting dimensions from the back. Accepted range is [-r, r-1] where
|
13
|
+
r = rank(input).
|
4
14
|
**Inputs**
|
5
15
|
Between 2 and 3 inputs.
|
6
16
|
* **x** (heterogeneous) - **T1**:
|
7
17
|
N-D full precision Input tensor to be quantized.
|
8
18
|
* **y_scale** (heterogeneous) - **tensor(float)**:
|
9
|
-
Scale for doing quantization to get 'y'. It
|
19
|
+
Scale for doing quantization to get 'y'. It can be a scalar, which
|
10
|
-
|
20
|
+
means per-tensor/layer quantization, or a 1-D Tensor for per-axis
|
21
|
+
quantization.
|
11
22
|
* **y_zero_point** (optional, heterogeneous) - **T2**:
|
12
|
-
Zero point for doing quantization to get 'y'.
|
23
|
+
Zero point for doing quantization to get 'y'. Shape must match
|
13
|
-
|
24
|
+
y_scale. Default is uint8 with zero point of 0 if it's not
|
14
|
-
|
25
|
+
specified.
|
15
26
|
**Outputs**
|
16
27
|
* **y** (heterogeneous) - **T2**:
|
17
28
|
N-D quantized output tensor. It has same shape as input 'x'.
|
18
29
|
**Type Constraints**
|
19
30
|
* **T1** in (
|
20
31
|
tensor(float),
|
21
32
|
tensor(int32)
|
22
33
|
):
|
23
34
|
Constrain 'x' to float or int32 tensor.
|
24
35
|
* **T2** in (
|
25
36
|
tensor(int8),
|
26
37
|
tensor(uint8)
|
27
38
|
):
|
28
39
|
Constrain 'y_zero_point' and 'y' to 8-bit integer tensor.
|