未验证 提交 ec72f5b2 编写于 作者: Q Qi Li 提交者: GitHub

fix ELU output for nan, test=develop (#31132)

上级 65bcaeb0
...@@ -1184,9 +1184,9 @@ struct ELUFunctor : public BaseActivationFunctor<T> { ...@@ -1184,9 +1184,9 @@ struct ELUFunctor : public BaseActivationFunctor<T> {
template <typename Device, typename X, typename Out> template <typename Device, typename X, typename Out>
void operator()(Device d, X x, Out out) const { void operator()(Device d, X x, Out out) const {
out.device(d) = x.cwiseMax(static_cast<T>(0)) + out.device(d) =
(static_cast<T>(alpha) * (x.exp() - static_cast<T>(1))) (x < static_cast<T>(0))
.cwiseMin(static_cast<T>(0)); .select(static_cast<T>(alpha) * (x.exp() - static_cast<T>(1)), x);
} }
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册