diff --git a/paddle/fluid/operators/activation_op.cc b/paddle/fluid/operators/activation_op.cc index acffb5d171d7bf52b57c1592c27966df95a37e23..7db6c6e6769c9929e1ce12c90886130058a4a1c5 100755 --- a/paddle/fluid/operators/activation_op.cc +++ b/paddle/fluid/operators/activation_op.cc @@ -36,20 +36,6 @@ static constexpr bool CanInplaceAct() { return GradFunctor::FwdDeps() == kDepOut || GradFunctor::FwdDeps() == kNoDeps; } -std::unique_ptr> GetInplaceOpSet() { - std::unique_ptr> ret( - new std::unordered_set()); -#define INSERT_INTO_INPLACE_OP_SET(op_type, __omitted, fwd_functor, \ - bwd_functor) \ - if (CanInplaceAct>()) { \ - ret->insert(#op_type); \ - } - - FOR_EACH_ACTIVATION_OP(INSERT_INTO_INPLACE_OP_SET); -#undef INSERT_INTO_INPLACE_OP_SET - return ret; -} - #define REGISTER_ACTIVATION_OP_MAKER(OP_NAME, OP_COMMENT) \ class OP_NAME##OpMaker \ : public ::paddle::framework::OpProtoAndCheckerMaker { \ diff --git a/paddle/fluid/operators/activation_op.h b/paddle/fluid/operators/activation_op.h index 1739aa2924d2e7fd97d07a2a39ba8323002f41c3..b4d01dfc6b93caab148ace1d7a70488fd628394f 100644 --- a/paddle/fluid/operators/activation_op.h +++ b/paddle/fluid/operators/activation_op.h @@ -49,21 +49,6 @@ enum ActBwdOpFwdDeps { kDepXOut = 0x03 }; -std::unique_ptr> GetInplaceOpSet(); - -static bool IsInplace(const std::string& op) { - static auto InplaceOpSet = GetInplaceOpSet(); - bool inplace = InplaceOpSet->count(op); - // for op_grad - const int kGradSuffixLen = 4; - if (op.size() > kGradSuffixLen && - op.compare(op.size() - kGradSuffixLen - 1, kGradSuffixLen, "grad")) { - inplace = - InplaceOpSet->count(op.substr(0, op.size() - (kGradSuffixLen + 1))); - } - return inplace; -} - /* The following operator can be used to process SelectedRows, because the * output of those operator for zero is zero too. */ diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 5db8b4df99adac35048997f24c86092838ca9b20..c0aeb82b7b87f6e2f52c3dd778a397d15a700b44 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -1080,9 +1080,6 @@ All parameter, weight, gradient are variables in Paddle. }, py::return_value_policy::take_ownership); - m.def("IsInplace", - [](std::string op) -> bool { return operators::IsInplace(op); }); - m.def("op_support_gpu", OpSupportGPU); #ifdef PADDLE_WITH_CUDA m.def("get_cuda_device_count", platform::GetCUDADeviceCount);