Fix acos op decomposition for non complex numbers to be more accurate
Opened this issue · 0 comments
GleasonK commented
What happened?
An initial fix was made for accuracy but was reverted due to a bug in the pattern generator:
#2449
This ticket tracks fixing that work and submitting a more accurate decomposition for acos op.
Current:
// Expand acos for non-complex arguments to MHLO dialect as follows:
// acos(x) = 2 * atan2(sqrt(1 - x^2), (1 + x)) if x != -1
Using 1-x^2 will be inaccurate when abs(x) is close to 1. The corresponding cancellation errors are avoided when using (1-x)*(1+x).
Steps to reproduce your issue
No response
Version information
No response