-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add StableHLO complex log1p operation. Add pass stablehlo-complex-mat…
…h-expander (#2636) As in the title. This PR introduces a new pass stablehlo-complex-math-expander that expands StableHLO complex functions in terms of StableHLO real functions. Currently, only StableHLO_Log1pOp on complex inputs is included in this expander, more will be added as follow-ups. The provided complex `log1p` operation fixes the inaccuracy problems in jax.numpy.log1p for complex inputs `x+i*y` when `x` is close to `-0.5 * y * y` which triggers catastrophic cancellations when using straightforward definition of log1p on complex inputs. The current state of `jax.numpy.log1p` inaccuracies is given in pearu/functional_algorithms#47 . With this PR, the accuracy statistics of log1p is: ``` complex64: ULP difference == 0 count is 961936 ULP difference == 1 count is 39644 ULP difference == 2 count is 455 ULP difference == 3 count is 0 ULP difference >= 4 count is 0 complex128: ULP difference == 0 count is 988144 ULP difference == 1 count is 13891 ULP difference == 2 count is 0 ULP difference == 3 count is 0 ULP difference >= 4 count is 0 ```
- Loading branch information
Showing
17 changed files
with
724 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.