提交 e0d5f8a8 编写于 作者: M minqiyang

Move compat module to python/paddle

上级 7e0f66e9
...@@ -205,8 +205,7 @@ void BindBlockDesc(pybind11::module *m) { ...@@ -205,8 +205,7 @@ void BindBlockDesc(pybind11::module *m) {
void BindVarDsec(pybind11::module *m) { void BindVarDsec(pybind11::module *m) {
pybind11::class_<pd::VarDesc> var_desc(*m, "VarDesc", ""); pybind11::class_<pd::VarDesc> var_desc(*m, "VarDesc", "");
var_desc var_desc
.def("name", [](pd::VarDesc &self) { return self.Name(); }, .def("name", &pd::VarDesc::Name, pybind11::return_value_policy::reference)
pybind11::return_value_policy::reference)
.def("set_name", &pd::VarDesc::SetName) .def("set_name", &pd::VarDesc::SetName)
.def("set_shape", &pd::VarDesc::SetShape) .def("set_shape", &pd::VarDesc::SetShape)
.def("set_shapes", &pd::VarDesc::SetShapes) .def("set_shapes", &pd::VarDesc::SetShapes)
......
...@@ -24,4 +24,5 @@ except ImportError: ...@@ -24,4 +24,5 @@ except ImportError:
import paddle.reader import paddle.reader
import paddle.dataset import paddle.dataset
import paddle.batch import paddle.batch
import paddle.compat
batch = batch.batch batch = batch.batch
...@@ -24,7 +24,7 @@ import tarfile ...@@ -24,7 +24,7 @@ import tarfile
import gzip import gzip
import itertools import itertools
import paddle.dataset.common import paddle.dataset.common
import paddle.fluid.compat as cpt import paddle.compat as cpt
from six.moves import zip, range from six.moves import zip, range
__all__ = ['test, get_dict', 'get_embedding', 'convert'] __all__ = ['test, get_dict', 'get_embedding', 'convert']
......
...@@ -28,7 +28,7 @@ import re ...@@ -28,7 +28,7 @@ import re
import random import random
import functools import functools
import six import six
import paddle.fluid.compat as cpt import paddle.compat as cpt
__all__ = [ __all__ = [
'train', 'test', 'get_movie_title_dict', 'max_movie_id', 'max_user_id', 'train', 'test', 'get_movie_title_dict', 'max_movie_id', 'max_user_id',
......
...@@ -24,7 +24,7 @@ import tarfile ...@@ -24,7 +24,7 @@ import tarfile
import gzip import gzip
import paddle.dataset.common import paddle.dataset.common
import paddle.fluid.compat as cpt import paddle.compat as cpt
__all__ = [ __all__ = [
'train', 'train',
......
...@@ -35,7 +35,7 @@ import gzip ...@@ -35,7 +35,7 @@ import gzip
from collections import defaultdict from collections import defaultdict
import paddle.dataset.common import paddle.dataset.common
import paddle.fluid.compat as cpt import paddle.compat as cpt
__all__ = [ __all__ = [
"train", "train",
......
...@@ -17,7 +17,7 @@ from . import core ...@@ -17,7 +17,7 @@ from . import core
import collections import collections
import copy import copy
import six import six
from . import compat as cpt from .. import compat as cpt
from . import unique_name from . import unique_name
__all__ = ['append_backward'] __all__ = ['append_backward']
......
...@@ -19,7 +19,7 @@ import six ...@@ -19,7 +19,7 @@ import six
import numpy as np import numpy as np
from . import compat as cpt from .. import compat as cpt
from .proto import framework_pb2 from .proto import framework_pb2
try: try:
from . import core from . import core
......
...@@ -20,7 +20,7 @@ from .layer_function_generator import autodoc, templatedoc ...@@ -20,7 +20,7 @@ from .layer_function_generator import autodoc, templatedoc
from ..layer_helper import LayerHelper from ..layer_helper import LayerHelper
from . import tensor from . import tensor
from . import nn from . import nn
from .. import compat as cpt from ... import compat as cpt
import math import math
import six import six
from functools import reduce from functools import reduce
......
...@@ -17,7 +17,7 @@ import multiprocessing ...@@ -17,7 +17,7 @@ import multiprocessing
from . import core from . import core
from . import framework from . import framework
from . import executor from . import executor
from . import compat as cpt from .. import compat as cpt
import warnings import warnings
import sys import sys
import six import six
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle.fluid.compat as cpt import paddle.compat as cpt
import six import six
......
...@@ -124,7 +124,7 @@ def runtime_main(test_class): ...@@ -124,7 +124,7 @@ def runtime_main(test_class):
model.run_trainer(p, endpoints, trainer_id, trainers, is_dist) model.run_trainer(p, endpoints, trainer_id, trainers, is_dist)
import paddle.fluid.compat as cpt import paddle.compat as cpt
class TestDistBase(unittest.TestCase): class TestDistBase(unittest.TestCase):
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.fluid.compat as cpt import paddle.compat as cpt
import paddle.fluid.core as core import paddle.fluid.core as core
import unittest import unittest
......
...@@ -17,7 +17,7 @@ import numpy as np ...@@ -17,7 +17,7 @@ import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle.fluid.core as core import paddle.fluid.core as core
from paddle.fluid.op import Operator from paddle.fluid.op import Operator
import paddle.fluid.compat as cpt import paddle.compat as cpt
class TestLookupTableOp(OpTest): class TestLookupTableOp(OpTest):
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import unittest import unittest
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid.compat as cpt import paddle.compat as cpt
from paddle.fluid.framework import Program, default_startup_program from paddle.fluid.framework import Program, default_startup_program
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import unittest import unittest
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid.compat as cpt import paddle.compat as cpt
from paddle.fluid.framework import Program from paddle.fluid.framework import Program
......
...@@ -16,7 +16,7 @@ import unittest ...@@ -16,7 +16,7 @@ import unittest
import numpy as np import numpy as np
import math import math
import sys import sys
import paddle.fluid.compat as cpt import paddle.compat as cpt
from op_test import OpTest from op_test import OpTest
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
from collections import defaultdict from collections import defaultdict
from .. import core from .. import core
from .. import compat as cpt from ... import compat as cpt
from ..framework import Program, default_main_program, Parameter from ..framework import Program, default_main_program, Parameter
from ..backward import _rename_arg_ from ..backward import _rename_arg_
from functools import reduce from functools import reduce
......
...@@ -27,7 +27,7 @@ from six.moves import zip ...@@ -27,7 +27,7 @@ from six.moves import zip
import itertools import itertools
import random import random
import zlib import zlib
import paddle.fluid.compat as cpt import paddle.compat as cpt
def map_readers(func, *readers): def map_readers(func, *readers):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册