Skip to content

Commit

Permalink
Test if TensorFlow Probability has merged bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Jul 17, 2020
1 parent 1e76261 commit 3ff8978
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions tests/test_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,12 @@ def test_percentile(backend):


# JAX doesn't yet support "nearest" as an interpolation scheme
# TensorFlow Probability uses a descending ordering causing nearest error
def test_percentile_interpolation(backend):
tb = pyhf.tensorlib
a = tb.astensor([[10, 7, 4], [3, 2, 1]])

assert tb.tolist(tb.percentile(a, 50, interpolation="linear")) == 3.5
# TODO: Unify this with NumPy through TFP team fixing difference
if tb.name == "tensorflow":
assert tb.tolist(tb.percentile(a, 50, interpolation="nearest")) == 4.0
else:
assert tb.tolist(tb.percentile(a, 50, interpolation="nearest")) == 3.0
assert tb.tolist(tb.percentile(a, 50, interpolation="nearest")) == 3.0
assert tb.tolist(tb.percentile(a, 50, interpolation="lower")) == 3.0
assert tb.tolist(tb.percentile(a, 50, interpolation="midpoint")) == 3.5
assert tb.tolist(tb.percentile(a, 50, interpolation="higher")) == 4.0
Expand Down

0 comments on commit 3ff8978

Please sign in to comment.