diff options
author | Michael McGeagh <michael.mcgeagh@arm.com> | 2020-08-07 11:54:28 +0100 |
---|---|---|
committer | Fredrik Knutsson <fredrik.knutsson.hunnebo@gmail.com> | 2020-08-12 06:30:46 +0000 |
commit | c5b549b599ff459a29115a48e8f067eaa5891638 (patch) | |
tree | 62b22dfda83f4665b10f549d9f9d7ddaedff15a1 /ethosu/vela/tflite_reader.py | |
parent | 5778ffdab61a46369c73c91f2c6289ba9833e3a3 (diff) | |
download | ethos-u-vela-c5b549b599ff459a29115a48e8f067eaa5891638.tar.gz |
MLBEDSW-2637 Utilise new tensor and operator funcs
add_input_tensor, set_output_tensor, create_const_tensor and
create_reshape_tensor have recently been added.
This replaces all found existing instances with these new helper
functions
Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com>
Change-Id: If33be8dbf237b2087b562b03cdeb51da1f99a786
Diffstat (limited to 'ethosu/vela/tflite_reader.py')
-rw-r--r-- | ethosu/vela/tflite_reader.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/ethosu/vela/tflite_reader.py b/ethosu/vela/tflite_reader.py index bf3fe950..5e966d1b 100644 --- a/ethosu/vela/tflite_reader.py +++ b/ethosu/vela/tflite_reader.py @@ -54,9 +54,7 @@ def clone_and_reshape_tensor(src_tens, reorder): tens.quant_values = tens.quant_values.transpose(reorder) op = Operation("Const", tens.name) - op.outputs = [tens] - tens.ops = [op] - + op.set_output_tensor(tens) return tens @@ -81,14 +79,12 @@ class TFLiteSubgraph: TensorError(tens, "This subgraph input tensor has unexpected driving operators.") op = Operation("Placeholder", tens.name) - op.outputs = [tens] - tens.ops = [op] + op.set_output_tensor(tens) for tens in self.tensors: if not tens.ops: op = Operation("Const", tens.name) - op.outputs = [tens] - tens.ops = [op] + op.set_output_tensor(tens) def get_tensors_from_indices_remove_duplicates(self, indices, warning_str): tensors = [] @@ -190,8 +186,7 @@ class TFLiteSubgraph: act_op = Operation(activation_function_to_split_out, name + activation_function_to_split_out) out_tens = op.outputs[0] intermediate_tens = out_tens.clone("_act_intermediate") - out_tens.ops = [act_op] - act_op.outputs = [out_tens] + act_op.set_output_tensor(out_tens) intermediate_tens.ops = [op] op.outputs[0] = intermediate_tens act_op.inputs = [intermediate_tens] |