diff --git a/paddle/framework/CMakeLists.txt b/paddle/framework/CMakeLists.txt index f8f9bae12d42ccbc52b1046900d239ae0cde6940..cbf950d54b9af671e910afdda3407b4ffab72408 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 cc47469b4db53458f6a4314f4339b58a9527637e..e9b83f40073df3ac857a301299bc1aeb6d6660c1 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);