| 454 | } // namespace |
| 455 | |
| 456 | XlaOp ErfInv(XlaOp x) { |
| 457 | auto& b = *x.builder(); |
| 458 | return b.ReportErrorOrReturn([&]() -> StatusOr<XlaOp> { |
| 459 | TF_RETURN_IF_ERROR(EnsureOperandIsRealFp("ErfInv", x)); |
| 460 | TF_ASSIGN_OR_RETURN(auto shape, b.GetShape(x)); |
| 461 | if (shape.element_type() == F64) { |
| 462 | return ErfInv64(x); |
| 463 | } |
| 464 | return DoWithUpcastToF32(x, {BF16, F16}, |
| 465 | [](XlaOp x) { return ErfInv32(x); }); |
| 466 | }); |
| 467 | } |
| 468 | |
| 469 | namespace { |
| 470 | // Coefficients for the Lanczos approximation of the gamma function. The |