def test_MAE(): x = Tensor(np.array([0.1, 0.2, 0.6, 0.9])) y = Tensor(np.array([0.1, 0.25, 0.7, 0.9])) error = MAE() error.clear() error.update(x, y) result = error.eval() assert math.isclose(result, 0.15 / 4)
def test_zero_MAE(): error = MAE() with pytest.raises(RuntimeError): error.eval()