提交 4bb2953c 编写于 作者: C Channingss

merge paddle/develop

...@@ -203,6 +203,14 @@ def paddle2onnx(model_path, save_dir): ...@@ -203,6 +203,14 @@ def paddle2onnx(model_path, save_dir):
mapper.convert(model.program, save_dir) mapper.convert(model.program, save_dir)
def paddle2onnx(model_path, save_dir):
from x2paddle.decoder.paddle_decoder import PaddleDecoder
from x2paddle.op_mapper.paddle_op_mapper import PaddleOpMapper
model = PaddleDecoder(model_path, '__model__', '__params__')
mapper = PaddleOpMapper()
mapper.convert(model.program, save_dir)
def main(): def main():
if len(sys.argv) < 2: if len(sys.argv) < 2:
print("Use \"x2paddle -h\" to print the help information") print("Use \"x2paddle -h\" to print the help information")
......
...@@ -334,24 +334,6 @@ class ONNXGraph(Graph): ...@@ -334,24 +334,6 @@ class ONNXGraph(Graph):
'external': False 'external': False
} }
# for item in self.graph.input:
# self.value_infos[item.name] = {
# 'dtype':
# TENSOR_TYPE_TO_NP_TYPE[item.type.tensor_type.elem_type],
# 'shape':
# [dim.dim_value for dim in item.type.tensor_type.shape.dim],
# 'external': True
# }
# for item in self.graph.output:
# #assert item.name not in value_info
# self.value_infos[item.name] = {
# 'dtype':
# TENSOR_TYPE_TO_NP_TYPE[item.type.tensor_type.elem_type],
# 'shape':
# [dim.dim_value for dim in item.type.tensor_type.shape.dim],
# 'external': True
# }
def allocate_shapes(self): def allocate_shapes(self):
""" """
run shape inference run shape inference
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册