未验证 提交 677cb91f 编写于 作者: W WJJ1995 提交者: GitHub

[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
上级 60d71cb6
...@@ -300,7 +300,7 @@ def onnx2paddle(model_path, ...@@ -300,7 +300,7 @@ def onnx2paddle(model_path,
from x2paddle.decoder.onnx_decoder import ONNXDecoder from x2paddle.decoder.onnx_decoder import ONNXDecoder
from x2paddle.op_mapper.onnx2paddle.onnx_op_mapper import ONNXOpMapper 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 = ONNXOpMapper(model)
mapper.paddle_graph.build() mapper.paddle_graph.build()
logging.info("Model optimizing ...") logging.info("Model optimizing ...")
......
...@@ -173,7 +173,7 @@ class ONNXGraphDataNode(GraphNode): ...@@ -173,7 +173,7 @@ class ONNXGraphDataNode(GraphNode):
class ONNXGraph(Graph): 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) super(ONNXGraph, self).__init__(onnx_model)
self.fixed_input_shape = {} self.fixed_input_shape = {}
if input_shape_dict is not None: if input_shape_dict is not None:
...@@ -395,7 +395,7 @@ class ONNXGraph(Graph): ...@@ -395,7 +395,7 @@ class ONNXGraph(Graph):
class ONNXDecoder(object): 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) onnx_model = onnx.load(onnx_model)
print('model ir_version: {}, op version: {}'.format( print('model ir_version: {}, op version: {}'.format(
onnx_model.ir_version, onnx_model.opset_import[0].version)) onnx_model.ir_version, onnx_model.opset_import[0].version))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册