diff --git a/oneflow/user/kernels/activation_kernels.h b/oneflow/user/kernels/activation_kernels.h index b8a0e907438..e81553e9004 100644 --- a/oneflow/user/kernels/activation_kernels.h +++ b/oneflow/user/kernels/activation_kernels.h @@ -29,13 +29,7 @@ struct LeakyReluFunctor { template struct LeakyReluGradFunctor { OF_DEVICE_FUNC explicit LeakyReluGradFunctor(float alpha) : alpha(alpha) {} - OF_DEVICE_FUNC T operator()(T x, T dy) const { - if (alpha > 0) { - return dy > 0 ? dy : dy * alpha; - } else { - return (x > 0) ? dy : dy * alpha; - } - } + OF_DEVICE_FUNC T operator()(T x, T dy) const { return (x > 0) ? dy : dy * alpha; } const T alpha; };