aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Svedberg <fredrik.svedberg@arm.com>2021-02-01 21:42:12 +0100
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2021-02-02 12:47:40 +0000
commitf2afd7f8a893487f5e1ecb96e3406a5b04f258d2 (patch)
tree9b9743d53a41de1e49cf02dd8c651d51a6f55f60
parentebf4af6a45c60d3f75ccd6019612a7f8b6552d72 (diff)
downloadethos-u-vela-f2afd7f8a893487f5e1ecb96e3406a5b04f258d2.tar.gz
[MLBEDSW-1743] Fix scaling for Abs operator
Fixed the scaling for the Abs operator. Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com> Change-Id: I9c198547de18f1268bfc2cb2f3d79cb30de4f43e
-rw-r--r--ethosu/vela/high_level_command_to_npu_op.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py
index 3143483..8d6fc87 100644
--- a/ethosu/vela/high_level_command_to_npu_op.py
+++ b/ethosu/vela/high_level_command_to_npu_op.py
@@ -428,6 +428,8 @@ def create_npu_elementwise_op(cmd: NpuStripe, arch: ArchitectureFeatures) -> Npu
# Force output scale same as the input scale for
# resizebilinear 1x1 that is converted to add
output_scale = npu_op.ifm2.quantization.scale_f32
+ if op.type == Op.Abs:
+ output_scale = npu_op.ifm.quantization.scale_f32 / npu_op.ofm.quantization.scale_f32
if op.type == Op.LeakyRelu:
output_scale = op.attrs["alpha"]
if op.type == Op.RescaleAdd: