From c74682cfd27eb2c203ce4486e712916c45da9881 Mon Sep 17 00:00:00 2001 From: Patrik Gustavsson Date: Tue, 17 Aug 2021 14:26:38 +0200 Subject: TOSA: Support for AVGPOOL, MAXPOOL and CONV2D Added support for -AVGPOOL and CONV2D with TFLite correspondence -MAXPOOL -additional support for replacing RESCALE ops with avgpool. No support for breaking down tensors over the size supported by NPU. Signed-off-by: Patrik Gustavsson Change-Id: I1d2aa50ac30a26283b3e6f1fe88cba1544b7c189 --- ethosu/vela/high_level_command_to_npu_op.py | 6 ++++++ 1 file changed, 6 insertions(+) (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 f8c9de36..c5d06465 100644 --- a/ethosu/vela/high_level_command_to_npu_op.py +++ b/ethosu/vela/high_level_command_to_npu_op.py @@ -204,6 +204,8 @@ def use_zero_point_0(ps, tens: Tensor, is_ifm_tensor: bool) -> bool: return True if ps.primary_op.type not in (Op.AvgPool, Op.ResizeBilinear, Op.CLZ, Op.SHL): return False + if ps.primary_op.type == Op.AvgPool and ps.primary_op.explicit_scaling: + return False fused_quantize = any(op.type == Op.Quantize for op in ps.ops) forced_ofm_quantization = ps.primary_op.forced_output_quantization use_0 = ( @@ -413,6 +415,10 @@ def create_npu_pool_op(cmd: NpuStripe, arch: ArchitectureFeatures) -> NpuPooling set_common_op_fields(npu_op, cmd, arch) # Pooling specific info npu_op.rescale = op.rescale + if op.explicit_scaling: + # Note: reuse of rescale for explicit scaling to not expose this in the external API + assert npu_op.rescale is None + npu_op.rescale = op.explicit_scaling return npu_op -- cgit v1.2.1