def test_le(a, b): "`test` that `a>b`" test(a, b, le, '<=')
def test_lt(a, b): "`test` that `a>b`" test(a, b, lt, '<')
def test_ge(a, b): "`test` that `a>=b`" test(a, b, ge, '>')
def test_gt(a, b): "`test` that `a>b`" test(a, b, gt, '>')
def test_not_close(a, b, eps=1e-5): "`test` that `a` is within `eps` of `b`" test(a, b, partial(is_not_close, eps=eps), 'not_close')
def test_eq_nan(a, b): "`test` that `a==b` excluding nan values (valid for torch.Tensor and np.ndarray)" mask_a = torch.isnan(a) if isinstance(a, torch.Tensor) else np.isnan(a) mask_b = torch.isnan(b) if isinstance(b, torch.Tensor) else np.isnan(b) test(a[~mask_a], b[~mask_b], equals, '==')