aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tensor.py
diff options
context:
space:
mode:
authorMichael McGeagh <michael.mcgeagh@arm.com>2020-07-28 12:17:59 +0100
committerMichael McGeagh <michael.mcgeagh@arm.com>2020-07-30 14:51:41 +0100
commit6a8d424b4d41fb5ea69996dd227ea74f794f7a64 (patch)
tree7ed25746851084dd6c8a1dc487920e035842a3f6 /ethosu/vela/tensor.py
parentd83d2e11d3dff5031fec513ca2aa22c19c9ea4d8 (diff)
downloadethos-u-vela-6a8d424b4d41fb5ea69996dd227ea74f794f7a64.tar.gz
vela: Move common functionality
There is a repeating pattern of setting the 3 different shapes in a tensor to a single shape value. This adds a new function in the tensor class that does this for you. Changed existing instances of manually setting shape to use this new function. Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com> Change-Id: Ibc74e741ea47cec473e6be42cc102f721ec63b11
Diffstat (limited to 'ethosu/vela/tensor.py')
-rw-r--r--ethosu/vela/tensor.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py
index 42ba853d..1a071e61 100644
--- a/ethosu/vela/tensor.py
+++ b/ethosu/vela/tensor.py
@@ -690,6 +690,11 @@ class Tensor:
return True
return False
+ def set_all_shapes(self, shape):
+ self.shape = shape
+ self.storage_shape = shape
+ self.bandwidth_shape = shape
+
def __str__(self):
return "<nng.Tensor '%s' shape=%s dtype=%s>" % (self.name, self.shape, self.dtype)