提交 b0a7761a 编写于 作者: C channingss

remove redundant code

上级 3a8db3c6
...@@ -151,7 +151,7 @@ def onnx2paddle(model_path, save_dir): ...@@ -151,7 +151,7 @@ def onnx2paddle(model_path, save_dir):
print("Now translating model from onnx to paddle.") print("Now translating model from onnx to paddle.")
from x2paddle.decoder.onnx_decoder import ONNXDecoder from x2paddle.decoder.onnx_decoder import ONNXDecoder
model = ONNXDecoder(model_path, save_dir) model = ONNXDecoder(model_path)
from x2paddle.op_mapper.onnx_op_mapper import ONNXOpMapper from x2paddle.op_mapper.onnx_op_mapper import ONNXOpMapper
mapper = ONNXOpMapper(model, save_dir) mapper = ONNXOpMapper(model, save_dir)
......
...@@ -132,16 +132,14 @@ class ONNXGraphDataNode(GraphNode): ...@@ -132,16 +132,14 @@ class ONNXGraphDataNode(GraphNode):
class ONNXGraph(Graph): class ONNXGraph(Graph):
def __init__(self, onnx_model, save_dir): def __init__(self, onnx_model):
super(ONNXGraph, self).__init__(onnx_model.graph) super(ONNXGraph, self).__init__(onnx_model.graph)
self.onnx_model = onnx_model self.onnx_model = onnx_model
self.initializer = {} self.initializer = {}
self.place_holder_nodes = list() self.place_holder_nodes = list()
self.get_place_holder_nodes() self.get_place_holder_nodes()
self.tmp_data_dir = os.path.join(save_dir, 'tmp_data')
self.value_infos = self.inferred_model_value_info(self.model) self.value_infos = self.inferred_model_value_info(self.model)
self.results_of_inference = dict() self.results_of_inference = dict()
self.is_inference = False
def get_inner_nodes(self): def get_inner_nodes(self):
""" """
...@@ -295,7 +293,7 @@ class ONNXGraph(Graph): ...@@ -295,7 +293,7 @@ class ONNXGraph(Graph):
class ONNXDecoder(object): class ONNXDecoder(object):
def __init__(self, onnx_model, save_dir): def __init__(self, onnx_model):
model = onnx.load(onnx_model) model = onnx.load(onnx_model)
print('model ir_version: {}, op version: {}'.format( print('model ir_version: {}, op version: {}'.format(
model.ir_version, model.opset_import[0].version)) model.ir_version, model.opset_import[0].version))
...@@ -314,7 +312,7 @@ class ONNXDecoder(object): ...@@ -314,7 +312,7 @@ class ONNXDecoder(object):
self.model = model self.model = model
graph = model.graph graph = model.graph
self.onnx_graph = ONNXGraph(model, save_dir) self.onnx_graph = ONNXGraph(model)
self.onnx_graph.build() self.onnx_graph.build()
def build_value_refs(self, nodes): def build_value_refs(self, nodes):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册