aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/high_level_command_to_npu_op.py
diff options
context:
space:
mode:
authorPatrik Gustavsson <patrik.gustavsson@arm.com>2021-08-17 14:26:38 +0200
committerPatrik Gustavsson <patrik.gustavsson@arm.com>2021-09-03 13:33:01 +0200
commitc74682cfd27eb2c203ce4486e712916c45da9881 (patch)
tree82ff1cefd0ce06d6072f0b1231802e7afa803b1a /ethosu/vela/high_level_command_to_npu_op.py
parent5e5a7847b8fc1eb261c7561f44585d2f6b524df3 (diff)
downloadethos-u-vela-c74682cfd27eb2c203ce4486e712916c45da9881.tar.gz
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 <patrik.gustavsson@arm.com> Change-Id: I1d2aa50ac30a26283b3e6f1fe88cba1544b7c189
Diffstat (limited to 'ethosu/vela/high_level_command_to_npu_op.py')
-rw-r--r--ethosu/vela/high_level_command_to_npu_op.py6
1 files changed, 6 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 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