From 04ce34c07cf7fcd0a8ddb29df6f59846862b24f2 Mon Sep 17 00:00:00 2001 From: Charles Xu Date: Tue, 23 Jun 2020 12:42:28 +0200 Subject: MLBEDSW-2340: Make the tensor address default None Signed-off-by: Charles Xu Change-Id: I53d9d56acee57cff208dccb4822c1f1a461c416d --- ethosu/vela/high_level_command_stream_generator.py | 2 +- ethosu/vela/live_range.py | 2 +- ethosu/vela/tensor.py | 4 ++-- ethosu/vela/tflite_writer.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'ethosu/vela') diff --git a/ethosu/vela/high_level_command_stream_generator.py b/ethosu/vela/high_level_command_stream_generator.py index d02fd85d..232a56c1 100644 --- a/ethosu/vela/high_level_command_stream_generator.py +++ b/ethosu/vela/high_level_command_stream_generator.py @@ -216,7 +216,7 @@ def generate_high_level_command_stream_for_pass(strat, passes, block_configs, id if len(passes) == 1: # no cascading, can just issue one big stripe # but only if we've done allocation and OFM does not overlap IFM - if ifm_tensor.address != -1 and ofm_tensor.address != -1: + if ifm_tensor.address is not None and ofm_tensor.address is not None: if ( ifm_tensor.address + ifm_tensor.storage_size() <= ofm_tensor.address or ofm_tensor.address + ofm_tensor.storage_size() <= ifm_tensor.address diff --git a/ethosu/vela/live_range.py b/ethosu/vela/live_range.py index 8fe3d571..fe00b622 100644 --- a/ethosu/vela/live_range.py +++ b/ethosu/vela/live_range.py @@ -85,7 +85,7 @@ class LiveRange: def set_address(self, address): # Set address of all unaddressed tensors in LiveRange for tens in self.tensors: - if tens.address == 0: + if tens.address is None: addr = address else: # Limit to single tensor for the lr if the tensor address already assigned diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py index eda21c9c..bc0597f6 100644 --- a/ethosu/vela/tensor.py +++ b/ethosu/vela/tensor.py @@ -291,7 +291,7 @@ class Tensor: self.weight_compressed_offsets = [] self.storage_rounding_quantum = (1, 1, 1, 1) self.brick_size = (1, 1, 1, 1) - self.address = 0 # start address of tensor. will be filled in by tensor allocator + self.address = None # start address of tensor. will be filled in by tensor allocator self.element_size_bytes = 0 # quantization parameters @@ -323,7 +323,7 @@ class Tensor: res.alignment = self.alignment res.bandwidth_compression_scale = self.bandwidth_compression_scale res.storage_rounding_quantum = self.storage_rounding_quantum - res.address = 0 + res.address = None if self.quantization is not None: res.quantization = self.quantization.clone() diff --git a/ethosu/vela/tflite_writer.py b/ethosu/vela/tflite_writer.py index 7e805e31..4aa23b5f 100644 --- a/ethosu/vela/tflite_writer.py +++ b/ethosu/vela/tflite_writer.py @@ -401,7 +401,7 @@ class TFLiteSerialiser: # Ensure that the order of the offsets match the order of the tensors for tens, idx in self.tensor_map.items(): # Set offsets for tensor allocated in Tensor Arena or in the scratch_fast area - if tens.mem_type in set((MemType.Scratch, MemType.Scratch_fast)): + if tens.mem_type in set((MemType.Scratch, MemType.Scratch_fast)) and tens.address is not None: offsets[idx] = np.int32(tens.address) metadata_buffer = np.array([version, subgraph_idx, nbr_tensors] + offsets) -- cgit v1.2.1