aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tosa_graph_optimiser.py
diff options
context:
space:
mode:
authorOscar Andersson <oscar.andersson@arm.com>2024-02-29 14:35:58 +0100
committeroscarandersson8218 <oscar.andersson@arm.com>2024-03-07 15:54:54 +0100
commitb90666d9b43f4b5223bb4dcecdbee87b2ad757c2 (patch)
treef4f3ce9c1a6af4625f68a21e68139140a4dd2119 /ethosu/vela/tosa_graph_optimiser.py
parent9341bf4b8de7b5a4db72281490492f6e32b0c605 (diff)
downloadethos-u-vela-b90666d9b43f4b5223bb4dcecdbee87b2ad757c2.tar.gz
TOSA fixes
- Fix TOSA imports - Handle weights connected to Identity nodes - Scaling info was missing in Fully Connected - Disable rescaling fusing for conv-like ops - Explicit scaling was missing for conv-like ops - Handle Const->Identity->Transpose chains - Handle Const->Identity->Reshape chains Change-Id: I063af1f187b6b56105ccf5e8e8b2eb0d3a39dd3b Signed-off-by: Oscar Andersson <oscar.andersson@arm.com>
Diffstat (limited to 'ethosu/vela/tosa_graph_optimiser.py')
-rw-r--r--ethosu/vela/tosa_graph_optimiser.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/ethosu/vela/tosa_graph_optimiser.py b/ethosu/vela/tosa_graph_optimiser.py
index c0689373..bcb4aac8 100644
--- a/ethosu/vela/tosa_graph_optimiser.py
+++ b/ethosu/vela/tosa_graph_optimiser.py
@@ -387,6 +387,8 @@ def rewrite_rescale(op, arch, nng):
ifm.quantization.zero_point = input_zp
ofm.quantization.zero_point = output_zp
+ assert per_channel is False, "per_channel rescale not supported"
+
for s, m in zip(shift, multiplier):
# TODO these are the TOSA limitations
assert m >= 0
@@ -403,11 +405,7 @@ def rewrite_rescale(op, arch, nng):
# Generate Rescale behaviour attached to a compatible NOP
avgpool_op = replace_rescale_with_avg_pool(op)
avgpool_op.rounding_mode = rounding_mode
-
- if per_channel:
- assert False, "per_channel rescale not supported"
- else:
- avgpool_op.explicit_scaling = explicit_scaling
+ avgpool_op.explicit_scaling = explicit_scaling
return op