From b081d67f3e96896ea0ca7426a18c5fe153419ee0 Mon Sep 17 00:00:00 2001 From: Patrik Gustavsson Date: Wed, 25 Aug 2021 13:49:25 +0200 Subject: TOSA: Added support for ADD, SUB and MUL Added support for ADD, SUB and MUL Signed-off-by: Patrik Gustavsson Change-Id: I52acdc126b16e2cf4096bcf7a77023ea7d204998 --- ethosu/vela/high_level_command_to_npu_op.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ethosu/vela/high_level_command_to_npu_op.py') diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py index c5d06465..67d1cd9b 100644 --- a/ethosu/vela/high_level_command_to_npu_op.py +++ b/ethosu/vela/high_level_command_to_npu_op.py @@ -86,6 +86,7 @@ dtype_map = { # Maps an elementwise op type to an elementwise_mode enum value used by NPU_OP_ELEMENTWISE elementwise_op_map = { Op.Mul: NpuElementWiseOp.MUL, + Op.RescaleMul: NpuElementWiseOp.MUL, Op.Add: NpuElementWiseOp.ADD, Op.RescaleAdd: NpuElementWiseOp.ADD, Op.Sub: NpuElementWiseOp.SUB, @@ -460,7 +461,7 @@ def create_npu_elementwise_op(cmd: NpuStripe, arch: ArchitectureFeatures) -> Npu 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: + if op.type in (Op.RescaleAdd, Op.RescaleMul): assert op.rescale is not None, f"{op.type} must have rescale" npu_op.rescale = op.rescale if op.type in (Op.Add, Op.Mul, Op.Sub): -- cgit v1.2.1