From a270ae04c5f7db6ac61933915eab4c9dac7c4123 Mon Sep 17 00:00:00 2001 From: jiangjiajun Date: Mon, 5 Aug 2019 14:05:15 +0800 Subject: [PATCH] modify --- x2paddle/core/graph.py | 12 ++++++------ x2paddle/core/op_mapper.py | 2 +- x2paddle/core/util.py | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/x2paddle/core/graph.py b/x2paddle/core/graph.py index 04a6e6e..0d7eb76 100644 --- a/x2paddle/core/graph.py +++ b/x2paddle/core/graph.py @@ -43,23 +43,23 @@ class Graph(object): self.model = model def build(self): - self._make_input_nodes() - self._make_output_nodes() - self._get_topo_sort() + self.get_input_nodes() + self.get_output_nodes() + self.get_topo_sort() - def _make_input_nodes(self): + def get_input_nodes(self): for name, node in self.node_map.items(): name = name.replace('/', '_').replace('-', '_') if len(node.inputs) == 0: self.input_nodes.append(name) - def _make_output_nodes(self): + def get_output_nodes(self): for name, node in self.node_map.items(): name = name.replace('/', '_').replace('-', '_') if len(node.outputs) == 0: self.output_nodes.append(name) - def _get_topo_sort(self): + def get_topo_sort(self): num_inputs = dict() for name, node in self.node_map.items(): num_inputs[name] = len(node.inputs) diff --git a/x2paddle/core/op_mapper.py b/x2paddle/core/op_mapper.py index 6ba557b..dacf4dd 100644 --- a/x2paddle/core/op_mapper.py +++ b/x2paddle/core/op_mapper.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +from paddle.fluid.proto import framework_pb2 from x2paddle.core.util import * import inspect import os diff --git a/x2paddle/core/util.py b/x2paddle/core/util.py index 45048b8..54524b8 100644 --- a/x2paddle/core/util.py +++ b/x2paddle/core/util.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.fluid.proto import framework_pb2 import paddle.fluid as fluid import numpy import math -- GitLab