aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tensor.py
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2023-05-16 22:39:14 +0100
committertim.hall <tim.hall@arm.com>2023-05-17 11:05:57 +0000
commit5ff4cd12898f44228288a7969b52dff97be30cb2 (patch)
tree1c8068c02254d5479706e41379bbd1f8c7b33205 /ethosu/vela/tensor.py
parent0426fe9de82e0f6b339edbd2bec78a5d322fb05f (diff)
downloadethos-u-vela-5ff4cd12898f44228288a7969b52dff97be30cb2.tar.gz
MLBEDSW-7223: Fusing Pad and AvgPool causes diff
- Fixed an issue with the fusing of PAD and AVERAGE_POOL_2D whereby the rounding away from zero didn't work because it requires the zero point to be at zero but the input padding required it to be set to the desired zero point. This affected both int8 and int16. The solution was to remove it by using the bias prior to the scaling - Refactored the rounding away from zero mode Change-Id: I8f2df69df06d2a9722315c346646e5a901cb2c3b Signed-off-by: Tim Hall <tim.hall@arm.com>
Diffstat (limited to 'ethosu/vela/tensor.py')
-rw-r--r--ethosu/vela/tensor.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py
index 8f685853..1e4ea115 100644
--- a/ethosu/vela/tensor.py
+++ b/ethosu/vela/tensor.py
@@ -215,7 +215,6 @@ class QuantizationParameters:
"max",
"num_bits",
"narrow_range",
- "next_after",
"scale_f32",
"zero_point",
"quant_min",
@@ -238,10 +237,6 @@ class QuantizationParameters:
self.num_bits = num_bits
self.narrow_range = narrow_range
- # Use the 'next after' float value of scale_f32 when converting to scale and shift. It can be combined with
- # natural rounding to perform rounding away from zero. This only affects the ofm scale and bias tensor, it has
- # no affect on global scaling i.e. the ofm_scale register
- self.next_after = False
self.scale_f32: Union[float, np.ndarray, None] = scale_f32
self.zero_point: Union[int, np.ndarray, None] = zero_point
self.quant_min: Optional[float] = None
@@ -251,7 +246,7 @@ class QuantizationParameters:
def __str__(self):
return (
f"<nng.QuantizationParameters min={self.min}, max={self.max}, num_bits={self.num_bits}, "
- f"scale={self.scale_f32}, zero_point={self.zero_point}, next={self.next_after}>"
+ f"scale={self.scale_f32}, zero_point={self.zero_point}>"
)
__repr__ = __str__
@@ -264,7 +259,6 @@ class QuantizationParameters:
res.num_bits = self.num_bits
res.narrow_range = self.narrow_range
- res.next_after = self.next_after
res.scale_f32 = self.scale_f32
res.zero_point = self.zero_point
res.quant_min = self.quant_min