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

Function ErfImpl32

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

Compute a polynomial approximation of the error function. Precondition: abs(x) <= 1. Otherwise, use ErfcImpl. This follows Cephes's f32 implementation of erf.

Source from the content-addressed store, hash-verified

204//
205// This follows Cephes's f32 implementation of erf.
206static XlaOp ErfImpl32(XlaOp x) {
207 // Coefficients for by erf(f32), from Cephes.
208 //
209 // erf(x) = x P(x^2), 0 < x < 1
210 static const std::array<float, 7> kErfTCoefficient{
211 +7.853861353153693E-5, -8.010193625184903E-4, +5.188327685732524E-3,
212 -2.685381193529856E-2, +1.128358514861418E-1, -3.761262582423300E-1,
213 +1.128379165726710E+0,
214 };
215 return x * EvaluatePolynomial<float>(x * x, kErfTCoefficient);
216}
217
218static XlaOp ErfcImpl64(XlaOp x) {
219 // Coefficients for erfc(f64), from Cephes.

Callers 2

ErfcFunction · 0.85
ErfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected