From 5509b8491437776f17e819e7f7594ea2a5aaadc6 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Thu, 3 Aug 2017 20:34:40 +0800 Subject: [PATCH] Merge Develop --- paddle/framework/CMakeLists.txt | 2 +- paddle/framework/pybind.cc | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/paddle/framework/CMakeLists.txt b/paddle/framework/CMakeLists.txt index f8f9bae12d..cbf950d54b 100644 --- a/paddle/framework/CMakeLists.txt +++ b/paddle/framework/CMakeLists.txt @@ -44,4 +44,4 @@ cc_library(paddle_pybind SHARED add_op mean_op cross_entropy_op - recurrent_network_op) + recurrent_op) diff --git a/paddle/framework/pybind.cc b/paddle/framework/pybind.cc index cc47469b4d..e9b83f4007 100644 --- a/paddle/framework/pybind.cc +++ b/paddle/framework/pybind.cc @@ -83,29 +83,28 @@ PYBIND11_PLUGIN(core) { self.Resize(make_ddim(dim)); }) .def("alloc_float", - [](pd::Tensor &self, paddle::platform::GPUPlace &place) { + [](Tensor &self, paddle::platform::GPUPlace &place) { self.mutable_data(place); }) .def("alloc_float", - [](pd::Tensor &self, paddle::platform::CPUPlace &place) { + [](Tensor &self, paddle::platform::CPUPlace &place) { self.mutable_data(place); }) .def("alloc_int", - [](pd::Tensor &self, paddle::platform::CPUPlace &place) { + [](Tensor &self, paddle::platform::CPUPlace &place) { self.mutable_data(place); }) .def("alloc_int", - [](pd::Tensor &self, paddle::platform::GPUPlace &place) { + [](Tensor &self, paddle::platform::GPUPlace &place) { self.mutable_data(place); }) - .def("set", paddle::pybind::PyCPUTensorSetFromArray) - .def("set", paddle::pybind::PyCPUTensorSetFromArray) + .def("set", PyCPUTensorSetFromArray) + .def("set", PyCPUTensorSetFromArray) #ifndef PADDLE_ONLY_CPU - .def("set", paddle::pybind::PyCUDATensorSetFromArray) - .def("set", paddle::pybind::PyCUDATensorSetFromArray) + .def("set", PyCUDATensorSetFromArray) + .def("set", PyCUDATensorSetFromArray) #endif - .def("shape", - [](pd::Tensor &self) { return pd::vectorize(self.dims()); }); + .def("shape", [](Tensor &self) { return vectorize(self.dims()); }); py::class_(m, "Variable", R"DOC(Variable Class. @@ -152,8 +151,8 @@ All parameter, weight, gradient are variables in Paddle. m.def_submodule( "var_names", "The module will return special predefined variable name in Paddle") - .def("empty", pd::OperatorBase::EMPTY_VAR_NAME) - .def("temp", pd::OperatorBase::TMP_VAR_NAME); + .def("empty", OperatorBase::EMPTY_VAR_NAME) + .def("temp", OperatorBase::TMP_VAR_NAME); // clang-format off py::class_(m, "DeviceContext") .def_static("create", @@ -190,9 +189,9 @@ All parameter, weight, gradient are variables in Paddle. }); operator_base.def("backward", - [](const pd::OperatorBase &forwardOp, + [](const OperatorBase &forwardOp, const std::unordered_set &no_grad_vars) { - return pd::Backward(forwardOp, no_grad_vars); + return Backward(forwardOp, no_grad_vars); }); ExposeOperator(operator_base); -- GitLab