From a250c56c523d09235cfba8626e2ebed6005f134e Mon Sep 17 00:00:00 2001 From: Zhang Ting Date: Wed, 12 Jan 2022 12:49:07 +0800 Subject: [PATCH] [part 4]change type of function args (#38888) --- paddle/fluid/operators/complex_op.h | 4 ++-- paddle/fluid/operators/label_smooth_op.cu | 4 ++-- paddle/fluid/operators/lgamma_op.cu | 2 +- paddle/fluid/operators/matrix_rank_op.h | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/operators/complex_op.h b/paddle/fluid/operators/complex_op.h index c6ae46f5a8..3dd5ea9f7e 100644 --- a/paddle/fluid/operators/complex_op.h +++ b/paddle/fluid/operators/complex_op.h @@ -25,14 +25,14 @@ namespace operators { // functors to use with ElementwiseComputeEx template struct RealAndImagToComplexFunctor { - inline HOSTDEVICE platform::complex operator()(const T& x, const T& y) { + inline HOSTDEVICE platform::complex operator()(const T x, const T y) { return platform::complex(x, y); } }; template struct ImagAndRealToComplexFunctor { - inline HOSTDEVICE platform::complex operator()(const T& y, const T& x) { + inline HOSTDEVICE platform::complex operator()(const T y, const T x) { return platform::complex(x, y); } }; diff --git a/paddle/fluid/operators/label_smooth_op.cu b/paddle/fluid/operators/label_smooth_op.cu index 2e7d1de3bd..2c7a08de0f 100644 --- a/paddle/fluid/operators/label_smooth_op.cu +++ b/paddle/fluid/operators/label_smooth_op.cu @@ -28,7 +28,7 @@ struct LabelSmoothFunctor { label_dim = static_cast(label_dim_data); } - __device__ __forceinline__ T operator()(const T& x) const { + __device__ __forceinline__ T operator()(const T x) const { return (static_cast(1 - epsilon) * x + static_cast(epsilon / label_dim)); } @@ -42,7 +42,7 @@ struct LabelSmoothGradFunctor { epsilon = static_cast(epsilon_data); } - __device__ __forceinline__ T operator()(const T& x) const { + __device__ __forceinline__ T operator()(const T x) const { return static_cast(1 - epsilon) * x; } }; diff --git a/paddle/fluid/operators/lgamma_op.cu b/paddle/fluid/operators/lgamma_op.cu index baf86c99b5..da40518d9b 100644 --- a/paddle/fluid/operators/lgamma_op.cu +++ b/paddle/fluid/operators/lgamma_op.cu @@ -21,7 +21,7 @@ namespace operators { template struct CudaLgammaFunctor { - __device__ __forceinline__ T operator()(const T& x) const { + __device__ __forceinline__ T operator()(const T x) const { return Eigen::numext::lgamma(x); } }; diff --git a/paddle/fluid/operators/matrix_rank_op.h b/paddle/fluid/operators/matrix_rank_op.h index 7fa7436833..c3d99a21b7 100644 --- a/paddle/fluid/operators/matrix_rank_op.h +++ b/paddle/fluid/operators/matrix_rank_op.h @@ -48,17 +48,17 @@ static DDim RemoveLastDim(const DDim& dim) { template struct GreaterThanFunctor { - HOSTDEVICE int operator()(const T& a, const T& b) const { return a > b; } + HOSTDEVICE int operator()(const T a, const T b) const { return a > b; } }; template struct LessThanFunctor { - HOSTDEVICE int operator()(const T& a, const T& b) const { return a < b; } + HOSTDEVICE int operator()(const T a, const T b) const { return a < b; } }; template struct GreaterElementFunctor { - HOSTDEVICE T operator()(const T& a, const T& b) const { + HOSTDEVICE T operator()(const T a, const T b) const { if (a > b) { return a; } else { -- GitLab