diff options
author | Michael McGeagh <michael.mcgeagh@arm.com> | 2020-12-02 12:39:03 +0000 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2020-12-08 14:58:19 +0000 |
commit | f3e3ad746de943e312c290d614184c0f6559ac1f (patch) | |
tree | 44f6eac5a6b1aec4114ad2c2faddced820ea1e17 /ethosu/vela/tensor.py | |
parent | d9c2c4258c50f04ef3a6c3849508d317249e8ebf (diff) | |
download | ethos-u-vela-f3e3ad746de943e312c290d614184c0f6559ac1f.tar.gz |
MLBEDSW-2836 Change sets to tuples
Replace conditional checks against sets with tuples.
If not requiring uniqueness, or complex set operations, it is quicker to
use tuples instead.
Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com>
Change-Id: Ie8732c8d46067244963936c53f0ec81adda50372
Diffstat (limited to 'ethosu/vela/tensor.py')
-rw-r--r-- | ethosu/vela/tensor.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py index b07b4dc3..f6e628c8 100644 --- a/ethosu/vela/tensor.py +++ b/ethosu/vela/tensor.py @@ -557,8 +557,10 @@ class Tensor: return self.consumer_list def get_address_ranges_for_coordinates(self, start_coord, end_coord): - if self.sub_purpose in set( - (TensorSubPurpose.RollingBufferX, TensorSubPurpose.RollingBufferY, TensorSubPurpose.RollingBufferXY) + if self.sub_purpose in ( + TensorSubPurpose.RollingBufferX, + TensorSubPurpose.RollingBufferY, + TensorSubPurpose.RollingBufferXY, ): # build dummy coordinates that cover the entire buffer start_coord = [0] * len(start_coord) @@ -637,7 +639,7 @@ class Tensor: augmented_shape[1] = 1 else: - assert self.format in set((TensorFormat.Unknown, TensorFormat.WeightsCompressed)) + assert self.format in (TensorFormat.Unknown, TensorFormat.WeightsCompressed) return None, None strides = [0] * len(augmented_shape) @@ -774,9 +776,7 @@ class Tensor: return address_offset def is_allocated_in_tensor_arena(self, scratch_tensor_mem_area): - if self.mem_area == scratch_tensor_mem_area and (self.mem_type in set((MemType.Scratch, MemType.Scratch_fast))): - return True - return False + return (self.mem_area == scratch_tensor_mem_area) and (self.mem_type in (MemType.Scratch, MemType.Scratch_fast)) def equivalent(self, tens): return self.equivalence_id == tens.equivalence_id |