From c2c0a2d39865ec8b6c9937793d67b64ee8507c81 Mon Sep 17 00:00:00 2001 From: Bin Li Date: Wed, 16 Oct 2019 19:07:04 +0800 Subject: [PATCH] Fix output tensor rename --- tools/python/transform/transformer.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/python/transform/transformer.py b/tools/python/transform/transformer.py index 778dcb1f..76d59ce9 100644 --- a/tools/python/transform/transformer.py +++ b/tools/python/transform/transformer.py @@ -307,14 +307,8 @@ class Transformer(base_converter.ConverterInterface): "!= len(replace_op.output)") for i in six.moves.range(len(op.output)): - for consumer_op in self._consumers.get(op.output[i], []): - self.replace(consumer_op.input, - op.output[i], - replace_op.output[i]) - - # if the op is output node, change replace_op output name to the op - # output name - for i in six.moves.range(len(op.output)): + # if the op is output node, change replace_op output name + # to the op output name if op.output[i] in self._option.output_nodes: for consumer in self._consumers.get( replace_op.output[i], []): @@ -322,6 +316,11 @@ class Transformer(base_converter.ConverterInterface): replace_op.output[i], op.output[i]) replace_op.output[i] = op.output[i] + else: + for consumer_op in self._consumers.get(op.output[i], []): + self.replace(consumer_op.input, + op.output[i], + replace_op.output[i]) if remove_input_tensor: for input_name in op.input: -- GitLab