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

Function ErfImpl64

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

Compute a polynomial approximation of the error function. Precondition: abs(x) <= 1. Otherwise, use ErfcImpl.

Source from the content-addressed store, hash-verified

259//
260// Precondition: abs(x) <= 1. Otherwise, use ErfcImpl.
261static XlaOp ErfImpl64(XlaOp x) {
262 // Coefficients for by erf(f64), from Cephes.
263 //
264 // erf(x) = x T(x^2) / U(x^2), 0 < x < 1
265 static std::array<double, 5> kErfTCoefficient{
266 9.60497373987051638749E0, 9.00260197203842689217E1,
267 2.23200534594684319226E3, 7.00332514112805075473E3,
268 5.55923013010394962768E4};
269 static std::array<double, 6> kErfUCoefficient{
270 1.00000000000000000000E0, 3.35617141647503099647E1,
271 5.21357949780152679795E2, 4.59432382970980127987E3,
272 2.26290000613890934246E4, 4.92673942608635921086E4};
273 XlaOp z = x * x;
274 return x * EvaluatePolynomial<double>(z, kErfTCoefficient) /
275 EvaluatePolynomial<double>(z, kErfUCoefficient);
276}
277
278XlaOp Erfc(XlaOp x) {
279 auto& b = *x.builder();

Callers 2

ErfcFunction · 0.85
ErfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected