aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ethosu/vela/graph_optimiser.py8
-rw-r--r--ethosu/vela/operation.py2
2 files changed, 6 insertions, 4 deletions
diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py
index d4423524..f6209ed2 100644
--- a/ethosu/vela/graph_optimiser.py
+++ b/ethosu/vela/graph_optimiser.py
@@ -421,7 +421,7 @@ def unfuse_activation_function(op, arch, nng):
def fixup_unpack_output(tens, arch, nng):
op = tens.ops[0]
- if op.type in set((Op.Unpack, Op.StridedSlice)):
+ if op.run_on_npu and op.type in set((Op.Unpack, Op.StridedSlice)):
# Unpack is also referred to as Unstack
# Requires the rewrite_split function to be called on the op afterwards
@@ -1061,7 +1061,7 @@ def optimise_graph_a(nng, arch, verbose_graph=False):
for idx, sg in enumerate(nng.subgraphs):
# rewrite graph pass
nng.subgraphs[idx] = rewrite_graph.rewrite_graph_pre_order(
- nng, sg, arch, [fixup_unpack_output], op_rewrite_list, rewrite_unsupported=False
+ nng, sg, arch, [], op_rewrite_list, rewrite_unsupported=False,
)
for idx, sg in enumerate(nng.subgraphs):
@@ -1081,7 +1081,9 @@ def optimise_graph_b(nng, arch, verbose_graph=False):
for idx, sg in enumerate(nng.subgraphs):
# combined rewrite graph pass
- nng.subgraphs[idx] = rewrite_graph.rewrite_graph_pre_order(nng, sg, arch, [rewrite_concat, rewrite_split], [])
+ nng.subgraphs[idx] = rewrite_graph.rewrite_graph_pre_order(
+ nng, sg, arch, [fixup_unpack_output, rewrite_concat, rewrite_split], []
+ )
if verbose_graph:
nng.print_graph()
diff --git a/ethosu/vela/operation.py b/ethosu/vela/operation.py
index 710511c6..6e5b4820 100644
--- a/ethosu/vela/operation.py
+++ b/ethosu/vela/operation.py
@@ -314,7 +314,7 @@ def get_slice_offsets(input_shape, offset_tens, offset_mask, is_begin=True):
class Operation:
"""Class representing a Neural Network operation. Has a name, a type,
-input and output tensors, as well as an attribute dictionary."""
+ input and output tensors, as well as an attribute dictionary."""
__slots__ = (
"type",