Skip to content

Commit

Permalink
Add StableHLO complex log to stablehlo-complex-math-expander pass (#2681
Browse files Browse the repository at this point in the history
)

As in the title. This PR is created on top of the branch of
#2679.

This PR improves the accuracy of JAX complex `log` function as follows:
```
Before
------
test_accuracy.py::test_unary[log-jax-cpu-complex64-default] maximal ULP difference: 4294967296
ULP difference == 0: 1612359
ULP difference == 1: 487617
ULP difference == 2: 306
ULP difference == 3: 140
ULP difference == 4: 68
ULP difference == 5: 49
ULP difference == 6: 26
ULP difference == 7: 35
ULP difference == 8: 19
ULP difference == 9: 15
ULP difference == 10: 15
ULP difference >= 11: 151

test_accuracy.py::test_unary[log-jax-cuda-complex64-default] maximal ULP difference: 4294967296
ULP difference == 0: 1797796
ULP difference == 1: 301398
ULP difference == 2: 1044
ULP difference == 3: 169
ULP difference == 4: 85
ULP difference == 5: 51
ULP difference == 6: 32
ULP difference == 7: 20
ULP difference == 8: 7
ULP difference == 9: 13
ULP difference == 10: 8
ULP difference >= 11: 177

After
-----
test_accuracy.py::test_unary[log-jax-cpu-complex64-default] maximal ULP difference: 3
ULP difference == 0: 1581126
ULP difference == 1: 519652
ULP difference == 2: 19
ULP difference == 3: 3

test_accuracy.py::test_unary[log-jax-cuda-complex64-default] maximal ULP difference: 2
ULP difference == 0: 1775914
ULP difference == 1: 324185
ULP difference == 2: 701
```

The corresponding accuracy patterns are available in
pearu/functional_algorithms#46 (comment)
.
  • Loading branch information
pearu authored Jan 8, 2025
1 parent 822cedf commit f67c73d
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build_tools/math/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ following requirements:

- Python 3.11 or newer
- mpmath 1.3 or newer
- functional_algorithms 0.13.2 or newer
- functional_algorithms 0.14.1 or newer

that can be installed via pypi:

Expand Down
1 change: 1 addition & 0 deletions build_tools/math/generate_ChloDecompositionPatternsMath.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def main(kind="CHLO"):
("CHLO_SquareOp", "real_square", ("x:float",)),
("StableHLO_Log1pOp", "complex_log1p", ("z:complex",)),
("StableHLO_SqrtOp", "complex_sqrt", ("z:complex",)),
("StableHLO_LogOp", "complex_log", ("z:complex",)),
]:
if not chloname.startswith(kind):
continue
Expand Down
8 changes: 6 additions & 2 deletions build_tools/math/generate_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
mpmath_name="log1p",
namespace="stablehlo",
passes="--stablehlo-complex-math-expander"),
dict(name="log",
mpmath_name="log",
namespace="stablehlo",
passes="--stablehlo-complex-math-expander"),
dict(name="sqrt",
mpmath_name="sqrt",
namespace="stablehlo",
Expand Down Expand Up @@ -117,8 +121,8 @@ def main():

if fa_version < required_fa_version:
msg = (
f"functional_algorithm version {'.'.join(map(str, required_fa_version))}"
f" or newer is required, got {fa.__version__}")
f"functional_algorithms version {'.'.join(map(str, required_fa_version))}"
f" or newer is required, got {fa.__version__}, stopping.")
warnings.warn(msg)
return

Expand Down
19 changes: 19 additions & 0 deletions stablehlo/tests/math/log_complex128.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: stablehlo-opt --stablehlo-complex-math-expander %s | stablehlo-translate --interpret
// This file is generated, see build_tools/math/README.md for more information.
module @log_complex128 {
func.func private @samples() -> tensor<169xcomplex<f64>> {
%0 = stablehlo.constant dense<"0x000000000000F0FF000000000000F0FFFFFFFFFFFFFFEFFF000000000000F0FFFEFFFFFFFFFFEFFF000000000000F0FF000000000000F8BF000000000000F0FF000000000000FC9F000000000000F0FF0100000000000080000000000000F0FF0000000000000000000000000000F0FF0100000000000000000000000000F0FF000000000000FC1F000000000000F0FF000000000000F83F000000000000F0FFFEFFFFFFFFFFEF7F000000000000F0FFFFFFFFFFFFFFEF7F000000000000F0FF000000000000F07F000000000000F0FF000000000000F0FFFFFFFFFFFFFFEFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFEFFFFEFFFFFFFFFFEFFFFFFFFFFFFFFFEFFF000000000000F8BFFFFFFFFFFFFFEFFF000000000000FC9FFFFFFFFFFFFFEFFF0100000000000080FFFFFFFFFFFFEFFF0000000000000000FFFFFFFFFFFFEFFF0100000000000000FFFFFFFFFFFFEFFF000000000000FC1FFFFFFFFFFFFFEFFF000000000000F83FFFFFFFFFFFFFEFFFFEFFFFFFFFFFEF7FFFFFFFFFFFFFEFFFFFFFFFFFFFFFEF7FFFFFFFFFFFFFEFFF000000000000F07FFFFFFFFFFFFFEFFF000000000000F0FFFEFFFFFFFFFFEFFFFFFFFFFFFFFFEFFFFEFFFFFFFFFFEFFFFEFFFFFFFFFFEFFFFEFFFFFFFFFFEFFF000000000000F8BFFEFFFFFFFFFFEFFF000000000000FC9FFEFFFFFFFFFFEFFF0100000000000080FEFFFFFFFFFFEFFF0000000000000000FEFFFFFFFFFFEFFF0100000000000000FEFFFFFFFFFFEFFF000000000000FC1FFEFFFFFFFFFFEFFF000000000000F83FFEFFFFFFFFFFEFFFFEFFFFFFFFFFEF7FFEFFFFFFFFFFEFFFFFFFFFFFFFFFEF7FFEFFFFFFFFFFEFFF000000000000F07FFEFFFFFFFFFFEFFF000000000000F0FF000000000000F8BFFFFFFFFFFFFFEFFF000000000000F8BFFEFFFFFFFFFFEFFF000000000000F8BF000000000000F8BF000000000000F8BF000000000000FC9F000000000000F8BF0100000000000080000000000000F8BF0000000000000000000000000000F8BF0100000000000000000000000000F8BF000000000000FC1F000000000000F8BF000000000000F83F000000000000F8BFFEFFFFFFFFFFEF7F000000000000F8BFFFFFFFFFFFFFEF7F000000000000F8BF000000000000F07F000000000000F8BF000000000000F0FF000000000000FC9FFFFFFFFFFFFFEFFF000000000000FC9FFEFFFFFFFFFFEFFF000000000000FC9F000000000000F8BF000000000000FC9F000000000000FC9F000000000000FC9F0100000000000080000000000000FC9F0000000000000000000000000000FC9F0100000000000000000000000000FC9F000000000000FC1F000000000000FC9F000000000000F83F000000000000FC9FFEFFFFFFFFFFEF7F000000000000FC9FFFFFFFFFFFFFEF7F000000000000FC9F000000000000F07F000000000000FC9F000000000000F0FF0100000000000080FFFFFFFFFFFFEFFF0100000000000080FEFFFFFFFFFFEFFF0100000000000080000000000000F8BF0100000000000080000000000000FC9F0100000000000080010000000000008001000000000000800000000000000000010000000000008001000000000000000100000000000080000000000000FC1F0100000000000080000000000000F83F0100000000000080FEFFFFFFFFFFEF7F0100000000000080FFFFFFFFFFFFEF7F0100000000000080000000000000F07F0100000000000080000000000000F0FF0000000000000000FFFFFFFFFFFFEFFF0000000000000000FEFFFFFFFFFFEFFF0000000000000000000000000000F8BF0000000000000000000000000000FC9F0000000000000000010000000000008000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000FC1F0000000000000000000000000000F83F0000000000000000FEFFFFFFFFFFEF7F0000000000000000FFFFFFFFFFFFEF7F0000000000000000000000000000F07F0000000000000000000000000000F0FF0100000000000000FFFFFFFFFFFFEFFF0100000000000000FEFFFFFFFFFFEFFF0100000000000000000000000000F8BF0100000000000000000000000000FC9F0100000000000000010000000000008001000000000000000000000000000000010000000000000001000000000000000100000000000000000000000000FC1F0100000000000000000000000000F83F0100000000000000FEFFFFFFFFFFEF7F0100000000000000FFFFFFFFFFFFEF7F0100000000000000000000000000F07F0100000000000000000000000000F0FF000000000000FC1FFFFFFFFFFFFFEFFF000000000000FC1FFEFFFFFFFFFFEFFF000000000000FC1F000000000000F8BF000000000000FC1F000000000000FC9F000000000000FC1F0100000000000080000000000000FC1F0000000000000000000000000000FC1F0100000000000000000000000000FC1F000000000000FC1F000000000000FC1F000000000000F83F000000000000FC1FFEFFFFFFFFFFEF7F000000000000FC1FFFFFFFFFFFFFEF7F000000000000FC1F000000000000F07F000000000000FC1F000000000000F0FF000000000000F83FFFFFFFFFFFFFEFFF000000000000F83FFEFFFFFFFFFFEFFF000000000000F83F000000000000F8BF000000000000F83F000000000000FC9F000000000000F83F0100000000000080000000000000F83F0000000000000000000000000000F83F0100000000000000000000000000F83F000000000000FC1F000000000000F83F000000000000F83F000000000000F83FFEFFFFFFFFFFEF7F000000000000F83FFFFFFFFFFFFFEF7F000000000000F83F000000000000F07F000000000000F83F000000000000F0FFFEFFFFFFFFFFEF7FFFFFFFFFFFFFEFFFFEFFFFFFFFFFEF7FFEFFFFFFFFFFEFFFFEFFFFFFFFFFEF7F000000000000F8BFFEFFFFFFFFFFEF7F000000000000FC9FFEFFFFFFFFFFEF7F0100000000000080FEFFFFFFFFFFEF7F0000000000000000FEFFFFFFFFFFEF7F0100000000000000FEFFFFFFFFFFEF7F000000000000FC1FFEFFFFFFFFFFEF7F000000000000F83FFEFFFFFFFFFFEF7FFEFFFFFFFFFFEF7FFEFFFFFFFFFFEF7FFFFFFFFFFFFFEF7FFEFFFFFFFFFFEF7F000000000000F07FFEFFFFFFFFFFEF7F000000000000F0FFFFFFFFFFFFFFEF7FFFFFFFFFFFFFEFFFFFFFFFFFFFFFEF7FFEFFFFFFFFFFEFFFFFFFFFFFFFFFEF7F000000000000F8BFFFFFFFFFFFFFEF7F000000000000FC9FFFFFFFFFFFFFEF7F0100000000000080FFFFFFFFFFFFEF7F0000000000000000FFFFFFFFFFFFEF7F0100000000000000FFFFFFFFFFFFEF7F000000000000FC1FFFFFFFFFFFFFEF7F000000000000F83FFFFFFFFFFFFFEF7FFEFFFFFFFFFFEF7FFFFFFFFFFFFFEF7FFFFFFFFFFFFFEF7FFFFFFFFFFFFFEF7F000000000000F07FFFFFFFFFFFFFEF7F000000000000F0FF000000000000F07FFFFFFFFFFFFFEFFF000000000000F07FFEFFFFFFFFFFEFFF000000000000F07F000000000000F8BF000000000000F07F000000000000FC9F000000000000F07F0100000000000080000000000000F07F0000000000000000000000000000F07F0100000000000000000000000000F07F000000000000FC1F000000000000F07F000000000000F83F000000000000F07FFEFFFFFFFFFFEF7F000000000000F07FFFFFFFFFFFFFEF7F000000000000F07F000000000000F07F000000000000F07F"> : tensor<169xcomplex<f64>>
return %0 : tensor<169xcomplex<f64>>
}
func.func private @expected() -> tensor<169xcomplex<f64>> {
%0 = stablehlo.constant dense<"0x000000000000F07FD221337F7CD902C0000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21F9BF000000000000F07F182D4454FB21E9BF000000000000F07F182D4454FB2109C036195AC708318640D221337F7CD902C036195AC708318640D221337F7CD902C0EF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BF36195AC708318640192D4454FB21E9BF36195AC708318640182D4454FB21E9BF000000000000F07F0000000000000000000000000000F07F182D4454FB2109C036195AC708318640D221337F7CD902C036195AC708318640D221337F7CD902C0EF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BFEF39FAFE422E8640182D4454FB21F9BF36195AC708318640182D4454FB21E9BF36195AC708318640182D4454FB21E9BF000000000000F07F0000000000000000000000000000F07F182D4454FB2109C0EF39FAFE422E8640182D4454FB2109C0EF39FAFE422E8640182D4454FB2109C01EE9DC75B310E83FD221337F7CD902C04C98BFEC23F3D93F182D4454FB21F9BF4C98BFEC23F3D93F182D4454FB21F9BF4C98BFEC23F3D93F182D4454FB21F9BF4C98BFEC23F3D93F182D4454FB21F9BF4C98BFEC23F3D93F182D4454FB21F9BF1EE9DC75B310E83F182D4454FB21E9BFEF39FAFE422E86400000000000000680EF39FAFE422E86400000000000000680000000000000F07F0000000000000000000000000000F07F182D4454FB2109C0EF39FAFE422E8640182D4454FB2109C0EF39FAFE422E8640182D4454FB2109C04C98BFEC23F3D93F182D4454FB2109C040438B3EC31F76C0D221337F7CD902C0CF014BCF4E2576C0182D4454FB21F9BFCF014BCF4E2576C0182D4454FB21F9BFCF014BCF4E2576C0182D4454FB21F9BF40438B3EC31F76C0182D4454FB21E9BF4C98BFEC23F3D93FABAAAAAAAAAAF29FEF39FAFE422E86400000000000000080EF39FAFE422E86400000000000000080000000000000F07F0000000000000000000000000000F07F182D4454FB2109C0EF39FAFE422E8640182D4454FB2109C0EF39FAFE422E8640182D4454FB2109C04C98BFEC23F3D93F182D4454FB2109C0CF014BCF4E2576C0182D4454FB2109C07C920D7CBF4087C0D221337F7CD902C0C3716D44854387C0182D4454FB21F9BF7C920D7CBF4087C0182D4454FB21E9BFCF014BCF4E2576C0922449922449C29C4C98BFEC23F3D93F0000000000000080EF39FAFE422E86400000000000000080EF39FAFE422E86400000000000000080000000000000F07F0000000000000000000000000000F07F182D4454FB210940EF39FAFE422E8640182D4454FB210940EF39FAFE422E8640182D4454FB2109404C98BFEC23F3D93F182D4454FB210940CF014BCF4E2576C0182D4454FB210940C3716D44854387C0182D4454FB210940000000000000F0FF0000000000000000C3716D44854387C00000000000000000CF014BCF4E2576C000000000000000004C98BFEC23F3D93F0000000000000000EF39FAFE422E86400000000000000000EF39FAFE422E86400000000000000000000000000000F07F0000000000000000000000000000F07F182D4454FB210940EF39FAFE422E8640182D4454FB210940EF39FAFE422E8640182D4454FB2109404C98BFEC23F3D93F182D4454FB210940CF014BCF4E2576C0182D4454FB2109407C920D7CBF4087C0D221337F7CD90240C3716D44854387C0182D4454FB21F93F7C920D7CBF4087C0182D4454FB21E93FCF014BCF4E2576C0922449922449C21C4C98BFEC23F3D93F0000000000000000EF39FAFE422E86400000000000000000EF39FAFE422E86400000000000000000000000000000F07F0000000000000000000000000000F07F182D4454FB210940EF39FAFE422E8640182D4454FB210940EF39FAFE422E8640182D4454FB2109404C98BFEC23F3D93F182D4454FB21094040438B3EC31F76C0D221337F7CD90240CF014BCF4E2576C0182D4454FB21F93FCF014BCF4E2576C0182D4454FB21F93FCF014BCF4E2576C0182D4454FB21F93F40438B3EC31F76C0182D4454FB21E93F4C98BFEC23F3D93FABAAAAAAAAAAF21FEF39FAFE422E86400000000000000000EF39FAFE422E86400000000000000000000000000000F07F0000000000000000000000000000F07F182D4454FB210940EF39FAFE422E8640182D4454FB210940EF39FAFE422E8640182D4454FB2109401EE9DC75B310E83FD221337F7CD902404C98BFEC23F3D93F182D4454FB21F93F4C98BFEC23F3D93F182D4454FB21F93F4C98BFEC23F3D93F182D4454FB21F93F4C98BFEC23F3D93F182D4454FB21F93F4C98BFEC23F3D93F182D4454FB21F93F1EE9DC75B310E83F182D4454FB21E93FEF39FAFE422E86400000000000000600EF39FAFE422E86400000000000000600000000000000F07F0000000000000000000000000000F07F182D4454FB21094036195AC708318640D221337F7CD9024036195AC708318640D221337F7CD90240EF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93F36195AC708318640182D4454FB21E93F36195AC708318640182D4454FB21E93F000000000000F07F0000000000000000000000000000F07F182D4454FB21094036195AC708318640D221337F7CD9024036195AC708318640D221337F7CD90240EF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93FEF39FAFE422E8640182D4454FB21F93F36195AC708318640192D4454FB21E93F36195AC708318640182D4454FB21E93F000000000000F07F0000000000000000000000000000F07FD221337F7CD90240000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21F93F000000000000F07F182D4454FB21E93F"> : tensor<169xcomplex<f64>>
return %0 : tensor<169xcomplex<f64>>
}
func.func public @main() {
%0 = call @samples() : () -> tensor<169xcomplex<f64>>
%1 = "stablehlo.log"(%0) : (tensor<169xcomplex<f64>>) -> tensor<169xcomplex<f64>>
%2 = call @expected() : () -> tensor<169xcomplex<f64>>
check.expect_close %1, %2, max_ulp_difference = 3 : tensor<169xcomplex<f64>>, tensor<169xcomplex<f64>>
func.return
}
}
19 changes: 19 additions & 0 deletions stablehlo/tests/math/log_complex64.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: stablehlo-opt --stablehlo-complex-math-expander %s | stablehlo-translate --interpret
// This file is generated, see build_tools/math/README.md for more information.
module @log_complex64 {
func.func private @samples() -> tensor<169xcomplex<f32>> {
%0 = stablehlo.constant dense<"0x000080FF000080FFFFFF7FFF000080FFFEFF7FFF000080FF0000C0BF000080FF0000E09F000080FF01000080000080FF00000000000080FF01000000000080FF0000E01F000080FF0000C03F000080FFFEFF7F7F000080FFFFFF7F7F000080FF0000807F000080FF000080FFFFFF7FFFFFFF7FFFFFFF7FFFFEFF7FFFFFFF7FFF0000C0BFFFFF7FFF0000E09FFFFF7FFF01000080FFFF7FFF00000000FFFF7FFF01000000FFFF7FFF0000E01FFFFF7FFF0000C03FFFFF7FFFFEFF7F7FFFFF7FFFFFFF7F7FFFFF7FFF0000807FFFFF7FFF000080FFFEFF7FFFFFFF7FFFFEFF7FFFFEFF7FFFFEFF7FFF0000C0BFFEFF7FFF0000E09FFEFF7FFF01000080FEFF7FFF00000000FEFF7FFF01000000FEFF7FFF0000E01FFEFF7FFF0000C03FFEFF7FFFFEFF7F7FFEFF7FFFFFFF7F7FFEFF7FFF0000807FFEFF7FFF000080FF0000C0BFFFFF7FFF0000C0BFFEFF7FFF0000C0BF0000C0BF0000C0BF0000E09F0000C0BF010000800000C0BF000000000000C0BF010000000000C0BF0000E01F0000C0BF0000C03F0000C0BFFEFF7F7F0000C0BFFFFF7F7F0000C0BF0000807F0000C0BF000080FF0000E09FFFFF7FFF0000E09FFEFF7FFF0000E09F0000C0BF0000E09F0000E09F0000E09F010000800000E09F000000000000E09F010000000000E09F0000E01F0000E09F0000C03F0000E09FFEFF7F7F0000E09FFFFF7F7F0000E09F0000807F0000E09F000080FF01000080FFFF7FFF01000080FEFF7FFF010000800000C0BF010000800000E09F010000800100008001000080000000000100008001000000010000800000E01F010000800000C03F01000080FEFF7F7F01000080FFFF7F7F010000800000807F01000080000080FF00000000FFFF7FFF00000000FEFF7FFF000000000000C0BF000000000000E09F000000000100008000000000000000000000000001000000000000000000E01F000000000000C03F00000000FEFF7F7F00000000FFFF7F7F000000000000807F00000000000080FF01000000FFFF7FFF01000000FEFF7FFF010000000000C0BF010000000000E09F010000000100008001000000000000000100000001000000010000000000E01F010000000000C03F01000000FEFF7F7F01000000FFFF7F7F010000000000807F01000000000080FF0000E01FFFFF7FFF0000E01FFEFF7FFF0000E01F0000C0BF0000E01F0000E09F0000E01F010000800000E01F000000000000E01F010000000000E01F0000E01F0000E01F0000C03F0000E01FFEFF7F7F0000E01FFFFF7F7F0000E01F0000807F0000E01F000080FF0000C03FFFFF7FFF0000C03FFEFF7FFF0000C03F0000C0BF0000C03F0000E09F0000C03F010000800000C03F000000000000C03F010000000000C03F0000E01F0000C03F0000C03F0000C03FFEFF7F7F0000C03FFFFF7F7F0000C03F0000807F0000C03F000080FFFEFF7F7FFFFF7FFFFEFF7F7FFEFF7FFFFEFF7F7F0000C0BFFEFF7F7F0000E09FFEFF7F7F01000080FEFF7F7F00000000FEFF7F7F01000000FEFF7F7F0000E01FFEFF7F7F0000C03FFEFF7F7FFEFF7F7FFEFF7F7FFFFF7F7FFEFF7F7F0000807FFEFF7F7F000080FFFFFF7F7FFFFF7FFFFFFF7F7FFEFF7FFFFFFF7F7F0000C0BFFFFF7F7F0000E09FFFFF7F7F01000080FFFF7F7F00000000FFFF7F7F01000000FFFF7F7F0000E01FFFFF7F7F0000C03FFFFF7F7FFEFF7F7FFFFF7F7FFFFF7F7FFFFF7F7F0000807FFFFF7F7F000080FF0000807FFFFF7FFF0000807FFEFF7FFF0000807F0000C0BF0000807F0000E09F0000807F010000800000807F000000000000807F010000000000807F0000E01F0000807F0000C03F0000807FFEFF7F7F0000807FFFFF7F7F0000807F0000807F0000807F"> : tensor<169xcomplex<f32>>
return %0 : tensor<169xcomplex<f32>>
}
func.func private @expected() -> tensor<169xcomplex<f32>> {
%0 = stablehlo.constant dense<"0x0000807FE4CB16C00000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0FC9BF0000807FDB0F49BF0000807FDB0F49C08A23B242E4CB16C08A23B242E4CB16C01872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF8A23B242DB0F49BF8A23B242DB0F49BF0000807F000000000000807FDB0F49C08A23B242E4CB16C08A23B242E4CB16C01872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF1872B142DB0FC9BF8A23B242DB0F49BF8A23B242DA0F49BF0000807F000000000000807FDB0F49C01872B142DB0F49C01872B142DB0F49C09C85403FE4CB16C01F99CF3EDB0FC9BF1F99CF3EDB0FC9BF1F99CF3EDB0FC9BF1F99CF3EDB0FC9BF1F99CF3EDB0FC9BF9C85403FDB0F49BF1872B142000030801872B142000030800000807F000000000000807FDB0F49C01872B142DB0F49C01872B142DB0F49C01F99CF3EDB0F49C028D22DC2E4CB16C00C352FC2DB0FC9BF0C352FC2DB0FC9BF0C352FC2DB0FC9BF28D22DC2DB0F49BF1F99CF3E5555959F1872B142000000801872B142000000800000807F000000000000807FDB0F49C01872B142DB0F49C01872B142DB0F49C01F99CF3EDB0F49C00C352FC2DB0F49C05EDDCDC2E4CB16C0D08ECEC2DB0FC9BF5EDDCDC2DB0F49BF0C352FC2254992941F99CF3E000000801872B142000000801872B142000000800000807F000000000000807FDB0F49401872B142DB0F49401872B142DB0F49401F99CF3EDB0F49400C352FC2DB0F4940D08ECEC2DB0F4940000080FF00000000D08ECEC2000000000C352FC2000000001F99CF3E000000001872B142000000001872B142000000000000807F000000000000807FDB0F49401872B142DB0F49401872B142DB0F49401F99CF3EDB0F49400C352FC2DB0F49405EDDCDC2E4CB1640D08ECEC2DB0FC93F5EDDCDC2DB0F493F0C352FC2254992141F99CF3E000000001872B142000000001872B142000000000000807F000000000000807FDB0F49401872B142DB0F49401872B142DB0F49401F99CF3EDB0F494028D22DC2E4CB16400C352FC2DB0FC93F0C352FC2DB0FC93F0C352FC2DB0FC93F28D22DC2DB0F493F1F99CF3E5555951F1872B142000000001872B142000000000000807F000000000000807FDB0F49401872B142DB0F49401872B142DB0F49409C85403FE4CB16401F99CF3EDB0FC93F1F99CF3EDB0FC93F1F99CF3EDB0FC93F1F99CF3EDB0FC93F1F99CF3EDB0FC93F9C85403FDB0F493F1872B142000030001872B142000030000000807F000000000000807FDB0F49408A23B242E4CB16408A23B242E4CB16401872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F8A23B242DB0F493F8A23B242DA0F493F0000807F000000000000807FDB0F49408A23B242E4CB16408A23B242E4CB16401872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F1872B142DB0FC93F8A23B242DB0F493F8A23B242DB0F493F0000807F000000000000807FE4CB16400000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0FC93F0000807FDB0F493F"> : tensor<169xcomplex<f32>>
return %0 : tensor<169xcomplex<f32>>
}
func.func public @main() {
%0 = call @samples() : () -> tensor<169xcomplex<f32>>
%1 = "stablehlo.log"(%0) : (tensor<169xcomplex<f32>>) -> tensor<169xcomplex<f32>>
%2 = call @expected() : () -> tensor<169xcomplex<f32>>
check.expect_close %1, %2, max_ulp_difference = 3 : tensor<169xcomplex<f32>>, tensor<169xcomplex<f32>>
func.return
}
}
Loading

0 comments on commit f67c73d

Please sign in to comment.