11 #ifndef EIGEN_MATHFUNCTIONSIMPL_H 12 #define EIGEN_MATHFUNCTIONSIMPL_H 30 const T plus_9 = pset1<T>(9.f);
31 const T minus_9 = pset1<T>(-9.f);
37 const T x =
pmax(minus_9,
pmin(plus_9,a_x));
39 const T alpha_1 = pset1<T>(4.89352455891786e-03
f);
40 const T alpha_3 = pset1<T>(6.37261928875436e-04
f);
41 const T alpha_5 = pset1<T>(1.48572235717979e-05
f);
42 const T alpha_7 = pset1<T>(5.12229709037114e-08
f);
43 const T alpha_9 = pset1<T>(-8.60467152213735e-11
f);
44 const T alpha_11 = pset1<T>(2.00018790482477e-13
f);
45 const T alpha_13 = pset1<T>(-2.76076847742355e-16
f);
48 const T beta_0 = pset1<T>(4.89352518554385e-03
f);
49 const T beta_2 = pset1<T>(2.26843463243900e-03
f);
50 const T beta_4 = pset1<T>(1.18534705686654e-04
f);
51 const T beta_6 = pset1<T>(1.19825839466702e-06
f);
54 const T x2 =
pmul(x, x);
57 T p =
pmadd(x2, alpha_13, alpha_11);
58 p =
pmadd(x2, p, alpha_9);
59 p =
pmadd(x2, p, alpha_7);
60 p =
pmadd(x2, p, alpha_5);
61 p =
pmadd(x2, p, alpha_3);
62 p =
pmadd(x2, p, alpha_1);
66 T
q =
pmadd(x2, beta_6, beta_4);
67 q =
pmadd(x2, q, beta_2);
68 q =
pmadd(x2, q, beta_0);
78 #endif // EIGEN_MATHFUNCTIONSIMPL_H static int f(const TensorMap< Tensor< int, 3 > > &tensor)
T generic_fast_tanh_float(const T &a_x)
EIGEN_DEVICE_FUNC Packet pmin(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC const Scalar & q
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f &a, const Packet4f &b, const Packet4f &c)
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC Packet pmax(const Packet &a, const Packet &b)