MLBEDSW-5209 Vela: output diff depthwise with non-zero zero points
Fixed by adjusting zero points for ops with int8 IFM and asymmetric weights
since the reference does not support asymmetric weights for int8 IFM and
ignores the zero points.
Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
Change-Id: I2a206a01a471a53aa864a6a3616aa23d2a5a23c8
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py
index d62ebc8..8c5e277 100644
--- a/ethosu/vela/tensor.py
+++ b/ethosu/vela/tensor.py
@@ -209,7 +209,17 @@
class QuantizationParameters:
- __slots__ = "min", "max", "num_bits", "narrow_range", "scale_f32", "zero_point", "quant_min", "quant_max"
+ __slots__ = (
+ "min",
+ "max",
+ "num_bits",
+ "narrow_range",
+ "scale_f32",
+ "zero_point",
+ "quant_min",
+ "quant_max",
+ "quant_dim",
+ )
def __init__(
self,
@@ -228,6 +238,7 @@
self.zero_point: Union[int, np.ndarray, None] = None
self.quant_min: Optional[float] = None
self.quant_max: Optional[float] = None
+ self.quant_dim: Optional[int] = None
def __str__(self):
return "<nng.QuantizationParameters min=%s max=%s, num_bits=%s, scale=%s, zero_point=%s>" % (
@@ -252,6 +263,7 @@
res.zero_point = self.zero_point
res.quant_min = self.quant_min
res.quant_max = self.quant_max
+ res.quant_dim = self.quant_dim
return res
def dequantize(self, values) -> np.ndarray: