Skip to content

Commit 8e58cb9

Browse files
[Precision Depth Alignment] paddle.log aligns with torch precision (PaddlePaddle#75799)
* accuracy_stable_log * accuracy_stable_log * fix * fix * fix * fix * fix5
1 parent 3289717 commit 8e58cb9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

paddle/phi/kernels/funcs/activation_functor.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5227,12 +5227,8 @@ __device__ __forceinline__
52275227
static_assert(!std::is_same<T, double>::value,
52285228
"this template must be used with float or less precise type");
52295229

5230-
#if defined(__CUDA_ARCH__) || defined(__HIP_ARCH__)
5231-
// use __logf fast approximation for peak bandwidth
5232-
return __logf(x);
5233-
#else
5234-
return ::log(x);
5235-
#endif
5230+
return static_cast<std::conditional_t<std::is_integral<T>::value, float, T>>(
5231+
::log(static_cast<double>(x)));
52365232
}
52375233

52385234
template <>

0 commit comments

Comments
 (0)