Exemplo n.º 1
0
def test_input_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()
    with pytest.raises(ValueError):
        error.update(x, y, x)
Exemplo n.º 2
0
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)