MLBEDSW-6881 SHAPE single op network is optimised to nothing
Fixed by adding an operation to copy the statically optimised
data to the subgraph output.
Change-Id: Ica757e37d5460237973444ffd39c7d2850f319e3
Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
diff --git a/ethosu/vela/live_range.py b/ethosu/vela/live_range.py
index fbb48ec..2829f39 100644
--- a/ethosu/vela/live_range.py
+++ b/ethosu/vela/live_range.py
@@ -240,11 +240,11 @@
rng = lr_graph.get_or_create_range(tens, cpu_tensor_alignment)
rng.mark_usage(time_for_pass)
- op_subgraph = cps.passes[0].ops[0].attrs.get("subgraph", None)
- op_type = cps.passes[0].ops[0].type
+ op = cps.passes[0].ops[0] if cps.passes[0].ops else None
+ op_subgraph = op.attrs.get("subgraph", None) if op else None
if op_subgraph is not None and MemType.Permanent_CPU not in target_mem_type_set:
- if op_type == Op.CustomNpuOp:
+ if op.type == Op.CustomNpuOp:
# If the primary-op is an NpuOp that means this is where an Npu subgraph
# is called. Go into said subgraph and extract live ranges before continuing.
# Use default allocation alignment of 16 for Npu tensors