From df5152551d933487c7e9f0edd47c7066f2c95f86 Mon Sep 17 00:00:00 2001 From: Zhang Ting Date: Fri, 21 Jan 2022 15:38:02 +0800 Subject: [PATCH] modify DivideFunctor to match ElementwiseSameDims template (#39041) --- paddle/fluid/operators/mean_op.cu | 3 +-- paddle/pten/kernels/gpu/math_kernel.cu | 15 --------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/paddle/fluid/operators/mean_op.cu b/paddle/fluid/operators/mean_op.cu index 5a0afb68d63..63b5b871aab 100644 --- a/paddle/fluid/operators/mean_op.cu +++ b/paddle/fluid/operators/mean_op.cu @@ -59,8 +59,7 @@ class MeanCUDAKernel : public framework::OpKernel { return; } - using MT = typename details::MPTypeTrait::Type; - using Div = kernel_primitives::DivideFunctor; + using Div = kernel_primitives::DivideFunctor; std::vector reduce_dims; reduce_dims.reserve(rank); for (decltype(rank) i = 0; i < rank; ++i) { diff --git a/paddle/pten/kernels/gpu/math_kernel.cu b/paddle/pten/kernels/gpu/math_kernel.cu index 80931db56c3..d7a16ac49b1 100644 --- a/paddle/pten/kernels/gpu/math_kernel.cu +++ b/paddle/pten/kernels/gpu/math_kernel.cu @@ -52,21 +52,6 @@ namespace pten { dev_ctx, inputs, &outputs, axis, funcs::name##Functor()); \ } -/** - * Util Functors - */ - -template -struct DivideFunctor { - HOSTDEVICE explicit inline DivideFunctor(int n) - : n_inv(static_cast(1.0 / n)) {} - - HOSTDEVICE inline T operator()(const T x) const { return x * n_inv; } - - private: - T n_inv; -}; - /** * Kernels */ -- GitLab