Adnios commented on a change in pull request #20339:
URL: https://github.com/apache/incubator-mxnet/pull/20339#discussion_r651361054
##########
File path: src/common/cuda/rtc/forward_functions-inl.h
##########
@@ -697,9 +697,11 @@ __device__ inline DType log_sigmoid(const DType val) {
template <typename DType>
__device__ inline DType mish(const DType val) {
if (type_util::has_double_or_integral<DType>::value) {
- return val * ::tanh(::log(1 + ::exp(val)));
+ const auto softrelu = (val > 20) ? val : ::log(1 + ::exp(val));
+ return val * ::tanh(softrelu);
} else {
- return val * ::tanhf(logf(1 + expf(val)));
+ const auto softrelu = (val > 20) ? val : logf(1 + expf(val));
+ return val * ::tanhf(softrelu);
Review comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]