From b0a7761af38066e3079244522ccfd26378fe0fd1 Mon Sep 17 00:00:00 2001 From: channingss Date: Wed, 11 Sep 2019 17:53:05 +0800 Subject: [PATCH] remove redundant code --- x2paddle/convert.py | 2 +- x2paddle/decoder/onnx_decoder.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/x2paddle/convert.py b/x2paddle/convert.py index 9d82425..b4566d1 100644 --- a/x2paddle/convert.py +++ b/x2paddle/convert.py @@ -151,7 +151,7 @@ def onnx2paddle(model_path, save_dir): print("Now translating model from onnx to paddle.") 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 mapper = ONNXOpMapper(model, save_dir) diff --git a/x2paddle/decoder/onnx_decoder.py b/x2paddle/decoder/onnx_decoder.py index 73cdd48..8955f1e 100644 --- a/x2paddle/decoder/onnx_decoder.py +++ b/x2paddle/decoder/onnx_decoder.py @@ -132,16 +132,14 @@ class ONNXGraphDataNode(GraphNode): class ONNXGraph(Graph): - def __init__(self, onnx_model, save_dir): + def __init__(self, onnx_model): super(ONNXGraph, self).__init__(onnx_model.graph) self.onnx_model = onnx_model self.initializer = {} self.place_holder_nodes = list() 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.results_of_inference = dict() - self.is_inference = False def get_inner_nodes(self): """ @@ -295,7 +293,7 @@ class ONNXGraph(Graph): class ONNXDecoder(object): - def __init__(self, onnx_model, save_dir): + def __init__(self, onnx_model): model = onnx.load(onnx_model) print('model ir_version: {}, op version: {}'.format( model.ir_version, model.opset_import[0].version)) @@ -314,7 +312,7 @@ class ONNXDecoder(object): self.model = model graph = model.graph - self.onnx_graph = ONNXGraph(model, save_dir) + self.onnx_graph = ONNXGraph(model) self.onnx_graph.build() def build_value_refs(self, nodes): -- GitLab