From 733f2bd1a817659d4936a43efa1786200ecaf3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=85?= Date: Thu, 15 Mar 2018 15:36:35 +0800 Subject: [PATCH] init shape before deciding if append dims --- mace/python/tools/tf_converter_lib.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mace/python/tools/tf_converter_lib.py b/mace/python/tools/tf_converter_lib.py index dc989796..7177a691 100644 --- a/mace/python/tools/tf_converter_lib.py +++ b/mace/python/tools/tf_converter_lib.py @@ -786,10 +786,9 @@ class TFConverter(object): reshape_op = self.tf_graph[softmax_op.name][0] self.unused_tensor.add(get_input_tensor(reshape_op, 1).name) - if reshape_op.outputs[0].shape.ndims == 2: - shape = [dim.value for dim in reshape_op.outputs[0].shape] - if len(shape) == 2: - shape = [1, 1, shape[0], shape[1]] + shape = [dim.value for dim in reshape_op.outputs[0].shape] + if len(shape) == 2: + shape = [1, 1, shape[0], shape[1]] op_def.output.extend([output.name for output in reshape_op.outputs]) self.add_output_shape([shape], op_def) self.resolved_ops[reshape_op.name] = 1 -- GitLab