From f2afd7f8a893487f5e1ecb96e3406a5b04f258d2 Mon Sep 17 00:00:00 2001 From: Fredrik Svedberg Date: Mon, 1 Feb 2021 21:42:12 +0100 Subject: [MLBEDSW-1743] Fix scaling for Abs operator Fixed the scaling for the Abs operator. Signed-off-by: Fredrik Svedberg Change-Id: I9c198547de18f1268bfc2cb2f3d79cb30de4f43e --- ethosu/vela/high_level_command_to_npu_op.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py index 31434835..8d6fc871 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: -- cgit v1.2.1