diff options
author | Dwight Lidman <dwight.lidman@arm.com> | 2020-12-17 15:14:45 +0100 |
---|---|---|
committer | Louis Verhaard <louis.verhaard@arm.com> | 2021-02-25 17:27:27 +0100 |
commit | 4f728c04bcc90742d9d57b0e253be68a7251984f (patch) | |
tree | 7e205e9fc90a36606d1939af406af20fa10b448d /ethosu/vela/high_level_command_to_npu_op.py | |
parent | 0cbb166cd032c779bd4681afef8097f0831ac8be (diff) | |
download | ethos-u-vela-4f728c04bcc90742d9d57b0e253be68a7251984f.tar.gz |
MLBEDSW-1499: Add MEAN operator
This commit adds support for the MEAN operator,
with some caveats.
Signed-off-by: Dwight Lidman <dwight.lidman@arm.com>
Change-Id: I165cb26cb5aefd68e70d2cfc68291ccf7b778921
Diffstat (limited to 'ethosu/vela/high_level_command_to_npu_op.py')
-rw-r--r-- | ethosu/vela/high_level_command_to_npu_op.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py index 1059e6e7..56c5e747 100644 --- a/ethosu/vela/high_level_command_to_npu_op.py +++ b/ethosu/vela/high_level_command_to_npu_op.py @@ -209,13 +209,15 @@ def use_zero_point_0(ps, tens: Tensor, is_ifm_tensor: bool) -> bool: def get_ifm_or_ifm2_quantization(ps, tens: Tensor) -> Optional[NpuQuantization]: """Gets quantization for IFM/IFM2""" - if tens.quantization is None: + op = ps.primary_op + ifm_quant = op.forced_input_quantization if op.forced_input_quantization is not None else tens.quantization + if ifm_quant is None: return None if use_zero_point_0(ps, tens, True): zero_point = 0 else: - zero_point = int(tens.quantization.zero_point) - return NpuQuantization(scale_f32=tens.quantization.scale_f32, zero_point=zero_point) + zero_point = int(ifm_quant.zero_point) + return NpuQuantization(scale_f32=ifm_quant.scale_f32, zero_point=zero_point) def get_ofm_quantization(ps, tens: Tensor) -> Optional[NpuQuantization]: @@ -389,8 +391,7 @@ def create_npu_pool_op(cmd: NpuStripe, arch: ArchitectureFeatures) -> NpuPooling npu_op = NpuPoolingOperation(pool_op) set_common_op_fields(npu_op, cmd, arch) # Pooling specific info - if op.type == Op.ResizeBilinear: - npu_op.rescale = op.rescale + npu_op.rescale = op.rescale return npu_op |