From e7c5c9d2de9f51e5d403c879a31c0297e0f40656 Mon Sep 17 00:00:00 2001 From: sneaxiy Date: Wed, 12 Dec 2018 12:41:47 +0000 Subject: [PATCH] remove unnecesary code test=develop --- paddle/fluid/pybind/pybind.cc | 14 -------------- python/paddle/fluid/layers/nn.py | 2 +- .../fluid/tests/unittests/test_py_func_op.py | 2 +- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 38b130833..348a07391 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -572,20 +572,6 @@ All parameter, weight, gradient are variables in Paddle. py::class_(m, "Place") .def(py::init<>()) - .def("is_cpu_place", - [](platform::Place &self) { return platform::is_cpu_place(self); }) - .def("is_gpu_place", - [](platform::Place &self) { return platform::is_gpu_place(self); }) - .def("is_cuda_pinned_place", - [](platform::Place &self) { - return platform::is_cuda_pinned_place(self); - }) - .def("gpu_device_id", - [](platform::Place &self) { - PADDLE_ENFORCE(platform::is_gpu_place(self), - "gpu_device_id() only supports in CUDAPlace"); - return boost::get(self).device; - }) .def("set_place", [](platform::Place &self, const platform::CPUPlace &cpu_place) { self = cpu_place; diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 655502500..d71368644 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -23,7 +23,7 @@ import os import inspect from ..layer_helper import LayerHelper from ..initializer import Normal, Constant -from ..framework import Variable, OpProtoHolder, Program +from ..framework import Variable, OpProtoHolder from ..param_attr import ParamAttr from .layer_function_generator import autodoc, templatedoc, _generate_doc_string_ from .tensor import concat diff --git a/python/paddle/fluid/tests/unittests/test_py_func_op.py b/python/paddle/fluid/tests/unittests/test_py_func_op.py index 0f03368b7..c71f2bdea 100644 --- a/python/paddle/fluid/tests/unittests/test_py_func_op.py +++ b/python/paddle/fluid/tests/unittests/test_py_func_op.py @@ -59,7 +59,7 @@ def simple_fc_net(img, label, use_py_func_op): size=200, bias_attr=fluid.ParamAttr( initializer=fluid.initializer.Constant(value=1.0))) - if use_py_func_op: + if not use_py_func_op: hidden = fluid.layers.tanh(hidden) else: new_hidden = fluid.default_main_program().current_block( -- GitLab