From 677cb91f7d6ab51dddebe5b49f2a037a8efec5a2 Mon Sep 17 00:00:00 2001 From: WJJ1995 Date: Mon, 13 Feb 2023 14:08:29 +0800 Subject: [PATCH] [Bug]Fixed ONNXDecoder (#939) * fixed Gemm bug * re-lint * fixed typo error * support fmod=1 * fixed nonzero bug * add nonzero test case * Support yolov8 for onnx * re-lint * fixed bug for paddleslim --- x2paddle/convert.py | 2 +- x2paddle/decoder/onnx_decoder.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x2paddle/convert.py b/x2paddle/convert.py index cadd9fd..792d8dc 100644 --- a/x2paddle/convert.py +++ b/x2paddle/convert.py @@ -300,7 +300,7 @@ def onnx2paddle(model_path, from x2paddle.decoder.onnx_decoder import ONNXDecoder from x2paddle.op_mapper.onnx2paddle.onnx_op_mapper import ONNXOpMapper - model = ONNXDecoder(model_path, input_shape_dict, enable_onnx_checker) + model = ONNXDecoder(model_path, enable_onnx_checker, input_shape_dict) mapper = ONNXOpMapper(model) mapper.paddle_graph.build() logging.info("Model optimizing ...") diff --git a/x2paddle/decoder/onnx_decoder.py b/x2paddle/decoder/onnx_decoder.py index f51be83..7fe4696 100755 --- a/x2paddle/decoder/onnx_decoder.py +++ b/x2paddle/decoder/onnx_decoder.py @@ -173,7 +173,7 @@ class ONNXGraphDataNode(GraphNode): class ONNXGraph(Graph): - def __init__(self, onnx_model, input_shape_dict): + def __init__(self, onnx_model, input_shape_dict=None): super(ONNXGraph, self).__init__(onnx_model) self.fixed_input_shape = {} if input_shape_dict is not None: @@ -395,7 +395,7 @@ class ONNXGraph(Graph): class ONNXDecoder(object): - def __init__(self, onnx_model, input_shape_dict, enable_onnx_checker): + def __init__(self, onnx_model, enable_onnx_checker, input_shape_dict=None): onnx_model = onnx.load(onnx_model) print('model ir_version: {}, op version: {}'.format( onnx_model.ir_version, onnx_model.opset_import[0].version)) -- GitLab