diff options
author | Johan Alfven <johan.alfven@arm.com> | 2023-05-09 16:33:41 +0200 |
---|---|---|
committer | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2023-05-10 09:30:04 +0000 |
commit | ac111101cccbdeddb4bef91a0a7b142e33c365c1 (patch) | |
tree | 9386fc28326a2eb38c2e9a8a7f13445da029f20c /ethosu | |
parent | 5fd155eb8f1d8da61f5d5dc8a925e8fb090c99d6 (diff) | |
download | ethos-u-vela-ac111101cccbdeddb4bef91a0a7b142e33c365c1.tar.gz |
MLBEDSW-7578: Fix output diff caused by wrong rounding in Conv2d
- The reference calculates the rounding different between
int8 and int16 for Conv2d. However, internally a Conv2d can be
changed to a FullyConnect but then the rounding must still be
calculated following the Conv2d reference.
- The fix is to check the original type if NATURAL rounding
should be used or not. int16 Conv2d uses NATURAL rounding
in reference.
Change-Id: I80d48b54372ef7b978ee2e9384a01934dd454e24
Signed-off-by: Johan Alfven <johan.alfven@arm.com>
Diffstat (limited to 'ethosu')
-rw-r--r-- | ethosu/vela/high_level_command_to_npu_op.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py index 7634fe1f..55b44730 100644 --- a/ethosu/vela/high_level_command_to_npu_op.py +++ b/ethosu/vela/high_level_command_to_npu_op.py @@ -134,7 +134,7 @@ def get_rounding_mode(op: Operation, fused_quantize: bool) -> NpuRoundingMode: if op.type.is_resize_op(): rounding_mode = NpuRoundingMode.NATURAL elif ( - op.type.npu_block_type in (NpuBlockType.ConvolutionMxN, NpuBlockType.ConvolutionDepthWise) + op._original_type.npu_block_type in (NpuBlockType.ConvolutionMxN, NpuBlockType.ConvolutionDepthWise) and op.ifm.dtype == DataType.int16 ): rounding_mode = NpuRoundingMode.NATURAL |