提交 423ceb0d 编写于 作者: C Channingss

update rely of paddle2onnx

上级 7d8c8b1a
...@@ -239,12 +239,16 @@ def pytorch2paddle(model_path, save_dir, input_shapes): ...@@ -239,12 +239,16 @@ def pytorch2paddle(model_path, save_dir, input_shapes):
def paddle2onnx(model_path, save_dir, opset_version=10): def paddle2onnx(model_path, save_dir, opset_version=10):
import paddle.fluid as fluid import paddle.fluid as fluid
try: try:
import paddle2onnx as p2o import paddle2onnx
except: except:
print( print(
"[ERROR] paddle2onnx not installed, use \"pip install paddle2onnx\"") "[ERROR] paddle2onnx not installed, use \"pip install paddle2onnx\"")
p2o.convert(
model_path, import paddle2onnx as p2o
model = p2o.PaddleDecoder(model_path, '__model__', '__params__')
mapper = p2o.PaddleOpMapper()
mapper.convert(
model.program,
save_dir, save_dir,
scope=fluid.global_scope(), scope=fluid.global_scope(),
opset_version=opset_version) opset_version=opset_version)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册