aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/high_level_command_to_npu_op.py
diff options
context:
space:
mode:
authorFredrik Svedberg <fredrik.svedberg@arm.com>2022-10-11 21:50:51 +0200
committerFredrik Svedberg <fredrik.svedberg@arm.com>2022-10-12 11:22:17 +0000
commitb81e1bb92be8ea5b29625cf2f361e9160286b16a (patch)
tree0963851b6d449224f67cce10ba510830db7b4172 /ethosu/vela/high_level_command_to_npu_op.py
parent3e3faa90def7c2c4aaaf71543726c881f05f53b5 (diff)
downloadethos-u-vela-b81e1bb92be8ea5b29625cf2f361e9160286b16a.tar.gz
MLBEDSW-6971 Fix output diff when cascading elementwise operators
Fixed output diff when cascading elementwise operators with reversed operand order. Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com> Change-Id: Iac2e28cfb53037b929459af213f4fa7715b3e6de
Diffstat (limited to 'ethosu/vela/high_level_command_to_npu_op.py')
-rw-r--r--ethosu/vela/high_level_command_to_npu_op.py5
1 files changed, 4 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 974d980c..202917bd 100644
--- a/ethosu/vela/high_level_command_to_npu_op.py
+++ b/ethosu/vela/high_level_command_to_npu_op.py
@@ -555,7 +555,10 @@ def create_npu_elementwise_op(cmd: NpuStripe, arch: ArchitectureFeatures) -> Npu
if elemwise_op not in UNARY_ELEMWISE_OPS:
ifm_shape = [] if cmd.ifm_tensor.shape == [] else ps.ifm_shapes[0].as_list()
ifm2_shape = [] if cmd.ifm2_tensor.shape == [] else ps.ifm_shapes[1].as_list()
- if not ifm_ifm2_correct_order(ifm_shape, ifm2_shape):
+ if cmd.reversed_operands:
+ assert ifm_ifm2_correct_order(ifm_shape, ifm2_shape)
+ npu_op.reversed_operands = True
+ elif not ifm_ifm2_correct_order(ifm_shape, ifm2_shape):
# The scalar/broadcasted feature map has to be the ifm2 tensor so switch the ifms
cmd.ifm_tensor, cmd.ifm2_tensor = cmd.ifm2_tensor, cmd.ifm_tensor
cmd.ifm_box, cmd.ifm2_box = cmd.ifm2_box, cmd.ifm_box