mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-07 18:27:40 +08:00
Added support for fp16 to the sigmoid function
This commit is contained in:
parent
f6003f0873
commit
c7167fee0e
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user