diff --git a/tests/beignet/special/test__erfc.py b/tests/beignet/special/test__erfc.py index 88718a9262..2267332779 100644 --- a/tests/beignet/special/test__erfc.py +++ b/tests/beignet/special/test__erfc.py @@ -59,7 +59,7 @@ def _strategy(function): @hypothesis.given(_strategy()) -def test_erf(data): +def test_erfc(data): input, output = data torch.testing.assert_close(beignet.special.erfc(input), output) diff --git a/tests/beignet/special/test__faddeeva_w.py b/tests/beignet/special/test__faddeeva_w.py new file mode 100644 index 0000000000..de2eacce29 --- /dev/null +++ b/tests/beignet/special/test__faddeeva_w.py @@ -0,0 +1,65 @@ +import beignet.special +import hypothesis +import hypothesis.strategies +import scipy +import torch + + +@hypothesis.strategies.composite +def _strategy(function): + x, y = torch.meshgrid( + torch.linspace( + function( + hypothesis.strategies.floats( + min_value=-10, + max_value=-10, + ), + ), + function( + hypothesis.strategies.floats( + min_value=10, + max_value=10, + ), + ), + steps=function( + hypothesis.strategies.integers( + min_value=128, + max_value=512, + ), + ), + dtype=torch.float64, + ), + torch.linspace( + function( + hypothesis.strategies.floats( + min_value=-10, + max_value=-10, + ), + ), + function( + hypothesis.strategies.floats( + min_value=10, + max_value=10, + ), + ), + function( + hypothesis.strategies.integers( + min_value=128, + max_value=512, + ), + ), + dtype=torch.float64, + ), + indexing="xy", + ) + + input = x + 1.0j * y + + return input, scipy.special.wofz(input) + + +@hypothesis.given(_strategy()) +def test_faddeeva_w(data): + input, output = data + + torch.testing.assert_close(beignet.special.faddeeva_w(input), output)