You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I come from a Python background. I have used numpy for array-based computing and recently started working on JAX. They have very easy-to-use array comparison functions 123 to check the relative, partial order etc. I find a lack of these functions/operators here. It would be a great enhancement and would help in testing code without writing a bunch of lines to compare errors or check the relationship between two arrays.
Until now I have been doing things like this,
assert!(distance.iter().all(|&d| d >= -ERR_MARGIN));
With the feature, it should more or less look like this,
You might already know, but enabling the approx feature will add some methods. They won't be named as you want though. I can find abs_diff_eq, relative_eq in the documentation, but there are also the assert versions: assert_relative_eq, assert_abs_diff_eq.
As for the element-wise method, I doubt that the maintainers want to add specific method like those, especially when they are so short and simple.
I'd have to check a little more closely, but I think we only implement these for array-to-array comparisons. Maybe we should consider implications for array-to-scalar, along with the approx traits for those?
Hi,
I come from a Python background. I have used numpy for array-based computing and recently started working on JAX. They have very easy-to-use array comparison functions 123 to check the relative, partial order etc. I find a lack of these functions/operators here. It would be a great enhancement and would help in testing code without writing a bunch of lines to compare errors or check the relationship between two arrays.
Until now I have been doing things like this,
With the feature, it should more or less look like this,
Footnotes
jax.numpy.allclose
↩jax.numpy.isclose
↩jax.numpy.equal
↩The text was updated successfully, but these errors were encountered: