Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using more precise log #33055

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion tensorflow/compiler/xla/client/lib/math.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,10 @@ XlaOp ErfInv(XlaOp x) {
0.00943887047f, 1.00167406f, 2.83297682f};

auto one = ScalarLike(x, 1.0);
auto w = -Log((one - x) * (one + x));
// Compute logarithm of (1+arg) using log1p(arg) which is more
// precise than log(1+arg) when arg is close to zero.
// See ref. https://en.cppreference.com/w/cpp/numeric/math/log1p
auto w = -Log1p(- x * x);

auto lt = Lt(w, ScalarLike(x, 5.0));
auto coefficient = [&](int i) {
Expand Down