Beispiel #1
0
def test_le(a, b):
    "`test` that `a>b`"
    test(a, b, le, '<=')
Beispiel #2
0
def test_lt(a, b):
    "`test` that `a>b`"
    test(a, b, lt, '<')
Beispiel #3
0
def test_ge(a, b):
    "`test` that `a>=b`"
    test(a, b, ge, '>')
Beispiel #4
0
def test_gt(a, b):
    "`test` that `a>b`"
    test(a, b, gt, '>')
Beispiel #5
0
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')
Beispiel #6
0
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, '==')