MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / I1eImpl32

Function I1eImpl32

tensorflow/compiler/xla/client/lib/math.cc:1504–1532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1502// i1e.
1503
1504static XlaOp I1eImpl32(XlaOp x) {
1505 static const std::array<float, 17> kI1eCoeffsA{
1506 9.38153738649577178388E-9f, -4.44505912879632808065E-8f,
1507 2.00329475355213526229E-7f, -8.56872026469545474066E-7f,
1508 3.47025130813767847674E-6f, -1.32731636560394358279E-5f,
1509 4.78156510755005422638E-5f, -1.61760815825896745588E-4f,
1510 5.12285956168575772895E-4f, -1.51357245063125314899E-3f,
1511 4.15642294431288815669E-3f, -1.05640848946261981558E-2f,
1512 2.47264490306265168283E-2f, -5.29459812080949914269E-2f,
1513 1.02643658689847095384E-1f, -1.76416518357834055153E-1f,
1514 2.52587186443633654823E-1f};
1515
1516 static const std::array<float, 7> kI1eCoeffsB{
1517 -3.83538038596423702205E-9f, -2.63146884688951950684E-8f,
1518 -2.51223623787020892529E-7f, -3.88256480887769039346E-6f,
1519 -1.10588938762623716291E-4f, -9.76109749136146840777E-3f,
1520 7.78576235018280120474E-1f};
1521 XlaOp z = Abs(x);
1522 auto half = xla::ScalarLike(x, 0.5);
1523 auto two = xla::ScalarLike(x, 2.0);
1524 auto thirty_two = xla::ScalarLike(x, 32.0);
1525 auto result_le_8 =
1526 z * EvaluateChebyshevPolynomial<float>(half * z - two, kI1eCoeffsA);
1527 auto result_gt_8 =
1528 EvaluateChebyshevPolynomial<float>(thirty_two / z - two, kI1eCoeffsB) /
1529 Sqrt(z);
1530 return Sign(x) *
1531 Select(Le(z, xla::ScalarLike(x, 8.0)), result_le_8, result_gt_8);
1532}
1533
1534static XlaOp I1eImpl64(XlaOp x) {
1535 static const std::array<double, 29> kI1eCoeffsA{

Callers 1

BesselI1eFunction · 0.85

Calls 6

ScalarLikeFunction · 0.85
AbsFunction · 0.50
SqrtFunction · 0.50
SignFunction · 0.50
SelectFunction · 0.50
LeFunction · 0.50

Tested by

no test coverage detected