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

Add complex data type support for tf.math.acos in XLA #41386

Merged

Conversation

yongtang
Copy link
Member

This PR tries to address the issur raised in #41370
where tf.math.acos throws out error with complex input data.
The issue was that in XLA the Acos op does not capture
the complex data types.

This PR adds complex support for tf.math.acos in XLA

This PR fixes #41370.

Signed-off-by: Yong Tang yong.tang.github@outlook.com

This PR tries to address the issur raised in 41370
where tf.math.acos throws out error with complex input data.
The issue was that in XLA the `Acos` op does not capture
the complex data types.

This PR adds complex support for tf.math.acos in XLA

This PR fixes 41370.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@google-ml-butler google-ml-butler bot added the size:S CL Change Size: Small label Jul 14, 2020
@gbaned gbaned self-assigned this Jul 15, 2020
@gbaned gbaned added comp:xla XLA prtype:bugfix PR to fix a bug labels Jul 15, 2020
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Jul 15, 2020
@gbaned gbaned requested a review from cheshire July 15, 2020 04:54
@gbaned gbaned added the awaiting review Pull request awaiting review label Jul 17, 2020
@gbaned gbaned requested a review from thomasjoerg August 3, 2020 16:55
return b->ReportErrorOrReturn([&]() -> StatusOr<XlaOp> {
TF_ASSIGN_OR_RETURN(auto shape, b->GetShape(x));

// complex: acos(x) = -i * log(x + sqrt(-(x+1)*(x-1)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code on line 1127 multiplies the sqrt by -i. The expression inside the sqrt is also a bit different.
Please eliminate the inconsistencies and move the comment up before the method.

…eview

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@yongtang
Copy link
Member Author

yongtang commented Aug 4, 2020

Thanks @thomasjoerg for the review. The PR has been updated with code comment moved to the top and changed to match the implementation. Please take a look and let me know if there are any issues.

@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Aug 6, 2020
@gbaned gbaned requested a review from thomasjoerg August 6, 2020 17:00
PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Aug 7, 2020
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Aug 7, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Aug 7, 2020
@gbaned gbaned added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Aug 8, 2020
@tensorflow-copybara tensorflow-copybara merged commit 2664391 into tensorflow:master Aug 17, 2020
PR Queue automation moved this from Approved by Reviewer to Merged Aug 17, 2020
@yongtang yongtang deleted the 41370-tf.math.acos-complex-xla branch August 17, 2020 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:xla XLA prtype:bugfix PR to fix a bug ready to pull PR ready for merge process size:S CL Change Size: Small
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

tf.math.acos raises UnimplementedError for complex tensors
7 participants