MLBEDSW-7385: Unbound local var bug fix
Treat Dynamic Weights as FeatureMap to avoid issues during scheduling
caused by having non constant OPs that produce tensors used as weights.
Change-Id: I2b9ee7fb62a150c5052c6c3b1a6d34f22e9426a9
Signed-off-by: Raul Farkas <raul.farkas@arm.com>
diff --git a/ethosu/vela/mark_tensors.py b/ethosu/vela/mark_tensors.py
index 4b5bf1d..13273e7 100644
--- a/ethosu/vela/mark_tensors.py
+++ b/ethosu/vela/mark_tensors.py
@@ -75,6 +75,10 @@
purpose = TensorPurpose.Weights
else:
purpose = TensorPurpose.FeatureMap
+ # Treat Dynamic Weights as FeatureMap to avoid issues during scheduling caused by
+ # having non constant OPs that produce tensors used as weights.
+ if any(op.type != Op.Const and tens == op.ofm and purpose == TensorPurpose.Weights for op in tens.ops):
+ purpose = TensorPurpose.FeatureMap
mark_purpose(tens, arch, purpose)
if op.type in memory_only_ops:
# Memory only operator input and output point to same data