diff --git a/paddle/fluid/operators/isfinite_op.cc b/paddle/fluid/operators/isfinite_op.cc index c4bc3a7fda154f42a07e10b453bba70afa41c629..7fdb0599ebfd19e75f0cd2e86885b086b18e2a39 100644 --- a/paddle/fluid/operators/isfinite_op.cc +++ b/paddle/fluid/operators/isfinite_op.cc @@ -132,4 +132,33 @@ namespace ops = paddle::operators; REGISTER_OP_MAKER(isinf, "isinf(X)"); REGISTER_OP_MAKER(isnan, "isnan(X)"); REGISTER_OP_MAKER(isfinite, "isfinite(X)"); -FOR_EACH_KERNEL_FUNCTOR(REGISTER_OVERFLOW_CPU_KERNEL); + +REGISTER_OP_CPU_KERNEL(isinf, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel); + +REGISTER_OP_CPU_KERNEL(isnan, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel); + +REGISTER_OP_CPU_KERNEL(isfinite, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel); diff --git a/paddle/fluid/operators/isfinite_op.cu b/paddle/fluid/operators/isfinite_op.cu index 995969cd42f08c7fa948262e42793106e745b3a7..e233e3713649050e857be9918ef7816d18e1b6ed 100644 --- a/paddle/fluid/operators/isfinite_op.cu +++ b/paddle/fluid/operators/isfinite_op.cu @@ -17,15 +17,32 @@ namespace ops = paddle::operators; namespace plat = paddle::platform; -#define REGISTER_OVERFLOW_CUDA_KERNEL(op_type, functor) \ - REGISTER_OP_CUDA_KERNEL( \ - op_type, ops::OverflowKernel, \ - ops::OverflowKernel, \ - ops::OverflowKernel, \ - ops::OverflowKernel); +REGISTER_OP_CUDA_KERNEL( + isinf, ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel); -FOR_EACH_KERNEL_FUNCTOR(REGISTER_OVERFLOW_CUDA_KERNEL); +REGISTER_OP_CUDA_KERNEL(isnan, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel); + +REGISTER_OP_CUDA_KERNEL( + isfinite, ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel, + ops::OverflowKernel); diff --git a/paddle/fluid/operators/isfinite_op.h b/paddle/fluid/operators/isfinite_op.h index abed0e6903dd39d2b3447455f8982e3df24e73fd..7f59af1be0efa7f21da40b44baa1f82da1b8cd87 100644 --- a/paddle/fluid/operators/isfinite_op.h +++ b/paddle/fluid/operators/isfinite_op.h @@ -73,8 +73,3 @@ class OverflowKernel : public framework::OpKernel { } // namespace operators } // namespace paddle - -#define FOR_EACH_KERNEL_FUNCTOR(__macro) \ - __macro(isinf, InfinityFunctor); \ - __macro(isnan, NANFunctor); \ - __macro(isfinite, IsfiniteFunctor);