aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tensor.py
diff options
context:
space:
mode:
authorJohan Alfven <johan.alfven@arm.com>2023-02-07 13:01:03 +0100
committerJohan Alfven <johan.alfven@arm.com>2023-02-14 13:29:26 +0100
commit9070f0f1d9ee0fbf2cc3ee62a60f9b600bd62055 (patch)
tree01ad61e2a33c9b976de53656743a24369ccc8119 /ethosu/vela/tensor.py
parent33c01e68984bf455d3a1f00c7f43ab2a6bb75cbe (diff)
downloadethos-u-vela-9070f0f1d9ee0fbf2cc3ee62a60f9b600bd62055.tar.gz
MLBEDSW-7316: Fix crash for networks with resource variables
- The problem was that networks with resource variables have not been thought of. The major problem was the graph traversal where these ops were not visited resulting in an empty subgraph that resulted in the crash. - Fixed the problem by attaching virtual tensors to the ops simulating subgraph output. These tensors are only used to get the graph traversal to work. - Fixed serializing of attribute container and shared_name - Fixed subgraph index for operator CallOnce - All resource variable ops are pushed to the CPU Change-Id: I815f9c81baf7a3fbb686e895980b462f58208b6e Signed-off-by: Johan Alfven <johan.alfven@arm.com>
Diffstat (limited to 'ethosu/vela/tensor.py')
-rw-r--r--ethosu/vela/tensor.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py
index 6a95bad4..008cd05e 100644
--- a/ethosu/vela/tensor.py
+++ b/ethosu/vela/tensor.py
@@ -114,7 +114,8 @@ class TensorPurpose(enum.IntFlag):
ScratchFast = 4
LUT = 5
FSBias = 6
- Size = 7
+ Virtual = 7
+ Size = 8
def display_name(self) -> str:
return ("Unknown", "Weights", "FeatureMap", "Scratch", "ScratchFast", "LUT", "FastStorageBias", "Size")[
@@ -297,6 +298,14 @@ class QuantizationParameters:
return False
+def create_virtual_tensor(
+ name: str,
+):
+ virtual_tensor = Tensor([], DataType.int8, name)
+ virtual_tensor.purpose = TensorPurpose.Virtual
+ return virtual_tensor
+
+
def create_const_tensor(
name: str,
shape: Shape,