Skip to content

Commit 0b54ea0

Browse files
XrekiAnnaTrainingG
authored andcommitted
Implement FunctionTraits to support two kinds of elementwise functor and remove some old codes for broadcast. (PaddlePaddle#35688)
1 parent 0d53fe9 commit 0b54ea0

17 files changed

+601
-795
lines changed

paddle/fluid/operators/abs_op.cu

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ struct CudaAbsFunctor;
2424

2525
template <typename T>
2626
struct CudaAbsFunctor<T, math::Complex<T, math::Real<T>>> {
27-
__device__ __forceinline__ math::Real<T> operator()(const T* args) const {
28-
return abs(args[0]);
27+
__device__ __forceinline__ math::Real<T> operator()(const T& x) const {
28+
return abs(x);
2929
}
3030
};
3131

3232
template <typename T>
3333
struct CudaAbsFunctor<T, math::NoComplex<T, math::Real<T>>> {
34-
__device__ __forceinline__ T operator()(const T* args) const {
35-
return std::abs(args[0]);
34+
__device__ __forceinline__ T operator()(const T& x) const {
35+
return std::abs(x);
3636
}
3737
};
3838

0 commit comments

Comments
 (0)