Added support for fp16 to the sigmoid function

This commit is contained in:
Benoit Steiner 2016-04-14 10:08:33 -07:00
parent f6003f0873
commit c7167fee0e

View File

@ -64,7 +64,7 @@ struct scalar_sigmoid_op {
EIGEN_EMPTY_STRUCT_CTOR(scalar_sigmoid_op)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& x) const {
const T one = T(1);
return one / (one + std::exp(-x));
return one / (one + numext::exp(-x));
}
template <typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
@ -799,7 +799,7 @@ class GaussianGenerator {
T offset = coordinates[i] - m_means[i];
tmp += offset * offset / m_two_sigmas[i];
}
return std::exp(-tmp);
return numext::exp(-tmp);
}
private: