Skip to content

Commit

Permalink
refactor: Use jax.numpy for JAX backend tensorlib.tolist (#1138)
Browse files Browse the repository at this point in the history
* Use jax.numpy.tolist to provide the tolist method for the JAX backend
   - Note that NumPy dependency can never be removed as JAX depends on
     NumPy for JAX to NumPy conversion
  • Loading branch information
matthewfeickert authored Nov 12, 2021
1 parent 2b2b281 commit d7a2706
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pyhf/tensor/jax_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def conditional(self, predicate, true_callable, false_callable):

def tolist(self, tensor_in):
try:
return np.asarray(tensor_in).tolist()
except AttributeError:
return jnp.asarray(tensor_in).tolist()
except TypeError:
if isinstance(tensor_in, list):
return tensor_in
raise
Expand Down

0 comments on commit d7a2706

Please sign in to comment.