========================================================================================================================================================== FAILURES ==========================================================================================================================================================
__________________________________________________________________________________________________________________________________________________ test_interp_scalar[jnp] ___________________________________________________________________________________________________________________________________________________
xnp = <module 'jax.numpy' from '/usr/lib/python3.11/site-packages/jax/numpy/__init__.py'>
@enp.testing.parametrize_xnp()
def test_interp_scalar(xnp: enp.NpModule):
vals = xnp.asarray(
[
[-1, -1],
[-1, 0],
[-1, 1],
[0.5, 1],
[1, 1],
]
)
#
out = enp.interp(vals, from_=(-1, 1), to=(0, 256))
assert enp.compat.is_array_xnp(out, xnp)
np.testing.assert_allclose(
out,
xnp.asarray([
[0, 0],
[0, 128],
[0, 256],
[192, 256],
[256, 256],
]),
)
np.testing.assert_allclose(
enp.interp(vals, from_=(-1, 1), to=(0, 1)),
xnp.asarray([
[0, 0],
[0, 0.5],
[0, 1],
[0.75, 1],
[1, 1],
]),
)
vals = xnp.asarray(
[
[255, 255, 0],
[255, 128, 0],
[255, 0, 128],
]
)
> np.testing.assert_allclose(
enp.interp(vals, from_=(0, 255), to=(0, 1)),
xnp.asarray([
[1, 1, 0],
[1, 128 / 255, 0],
[1, 0, 128 / 255],
]),
)
etils/enp/interp_utils_test.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<function assert_allclose.<locals>.compare at 0x7fe9a8bc6840>, array([[0.99999994, 0.99999994, 0. ],
[0... , 0. ],
[1. , 0.5019608, 0. ],
[1. , 0. , 0.5019608]], dtype=float32))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=0', 'verbose': True}
@wraps(func)
def inner(*args, **kwds):
with self._recreate_cm():
> return func(*args, **kwds)
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E
E Mismatched elements: 2 / 9 (22.2%)
E Max absolute difference: 5.9604645e-08
E Max relative difference: 1.1874362e-07
E x: array([[1. , 1. , 0. ],
E [1. , 0.501961, 0. ],
E [1. , 0. , 0.501961]], dtype=float32)
E y: array([[1. , 1. , 0. ],
E [1. , 0.501961, 0. ],
E [1. , 0. , 0.501961]], dtype=float32)
/usr/lib/python3.11/contextlib.py:81: AssertionError