aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/graph_optimiser.py
diff options
context:
space:
mode:
authorDwight Lidman <dwight.lidman@arm.com>2021-04-28 10:55:46 +0200
committerDwight Lidman <dwight.lidman@arm.com>2021-04-29 07:55:26 +0000
commitdec6fbcb16fa2f3d7254c4beb3235ab50f72a923 (patch)
tree3657084dd74701207654e673b82dab3793afdcc3 /ethosu/vela/graph_optimiser.py
parent2f75457df27da610afdf01b1c86535030b022a45 (diff)
downloadethos-u-vela-dec6fbcb16fa2f3d7254c4beb3235ab50f72a923.tar.gz
MLBEDSW-4501: Support MEAN single axis variation
When a MEAN operator with a single reduction axis specifies the axis index attribute as an array with a single element rather than a scalar index, the operator is placed on the CPU even though it is technically supported. This commit fixes this issue and also adds some new tests for the axis constraints. Signed-off-by: Dwight Lidman <dwight.lidman@arm.com> Change-Id: Ia287f3b9cc80a805e972cd4b2962e52526a8dc16
Diffstat (limited to 'ethosu/vela/graph_optimiser.py')
-rw-r--r--ethosu/vela/graph_optimiser.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py
index 642f1349..7c60368d 100644
--- a/ethosu/vela/graph_optimiser.py
+++ b/ethosu/vela/graph_optimiser.py
@@ -1472,8 +1472,8 @@ def convert_mean_to_depthwise_conv_or_avgpool(op, arch, nng):
dims = len(shape)
# Height and width axes have different index depending on dimensions
- if axis.shape == []: # single axis
- axis = int(axis.values)
+ if len(axis.shape) <= 1: # single axis
+ axis = int(axis.values) if len(axis.shape) == 0 else axis.values[0]
if dims in (2, 3):
if axis == 0:
h, w = shape[axis], 1