diff --git a/x2paddle/core/graph.py b/x2paddle/core/graph.py index 04a6e6e579d5ce25b77478446bd3f3977e8a7385..0d7eb76b2833ffed6b3f16bd58c1d3531d4cbdc9 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 6ba557bdf5865043747a20806e8ab8da021ff822..dacf4dd37c9411fb3d48888c9ea22ecd25e86956 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 45048b82c2ae9fa143ab4140600a79ef209cc574..54524b8fd5e8e678c80982abb59398241bfc0f70 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