From ebb759f5eef917a4b7b487d60de0db520507504b Mon Sep 17 00:00:00 2001 From: liutuo Date: Tue, 11 Jun 2019 18:10:40 +0800 Subject: [PATCH] fix fold reshape --- mace/python/tools/converter_tool/transformer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mace/python/tools/converter_tool/transformer.py b/mace/python/tools/converter_tool/transformer.py index fe5b08d6..1a9b7993 100644 --- a/mace/python/tools/converter_tool/transformer.py +++ b/mace/python/tools/converter_tool/transformer.py @@ -1192,7 +1192,11 @@ class Transformer(base_converter.ConverterInterface): and self._producer[op.input[0]].type \ == MaceOp.Reshape.name \ and len(op.output_shape[0].dims) == 2: - should_fold = True + producer = self._producer[op.input[0]] + reshape_input_rank = len(self.get_tensor_shape( + producer.input[0])) + if reshape_input_rank == 4: + should_fold = True if should_fold: print( -- GitLab