|
| 1 | +from sys import platform |
1 | 2 | import pytest
|
2 | 3 | import logging
|
3 | 4 | import numpy as np
|
@@ -51,7 +52,10 @@ def test_simple_tensor_ops(backend):
|
51 | 52 | 4,
|
52 | 53 | ]
|
53 | 54 | assert tb.tolist(tb.sqrt(tb.astensor([4, 9, 16]))) == [2, 3, 4]
|
54 |
| - assert tb.tolist(tb.log(tb.exp(tb.astensor([2, 3, 4])))) == [2, 3, 4] |
| 55 | + # c.f. Issue #1759 |
| 56 | + assert tb.tolist(tb.log(tb.exp(tb.astensor([2, 3, 4])))) == pytest.approx( |
| 57 | + [2, 3, 4], 1e-9 |
| 58 | + ) |
55 | 59 | assert tb.tolist(tb.abs(tb.astensor([-1, -2]))) == [1, 2]
|
56 | 60 | assert tb.tolist(tb.erf(tb.astensor([-2.0, -1.0, 0.0, 1.0, 2.0]))) == pytest.approx(
|
57 | 61 | [
|
@@ -86,6 +90,17 @@ def test_simple_tensor_ops(backend):
|
86 | 90 | ]
|
87 | 91 |
|
88 | 92 |
|
| 93 | +@pytest.mark.xfail(platform == "darwin", reason="c.f. Issue #1759") |
| 94 | +@pytest.mark.only_tensorflow |
| 95 | +def test_simple_tensor_ops_floating_point(backend): |
| 96 | + """ |
| 97 | + xfail test to know if test_simple_tensor_ops stops failing for tensorflow |
| 98 | + on macos |
| 99 | + """ |
| 100 | + tb = pyhf.tensorlib |
| 101 | + assert tb.tolist(tb.log(tb.exp(tb.astensor([2, 3, 4])))) == [2, 3, 4] |
| 102 | + |
| 103 | + |
89 | 104 | def test_tensor_where_scalar(backend):
|
90 | 105 | tb = pyhf.tensorlib
|
91 | 106 | assert tb.tolist(tb.where(tb.astensor([1, 0, 1], dtype="bool"), 1, 2)) == [1, 2, 1]
|
|
0 commit comments