Exemplo n.º 1
0
def test_minus_grad():
    a = variable.Variables(100)
    b = variable.Variables(10)

    c = Arithmetic.Minus(a, b)
    c.backward(1)

    assert a.get_grad() == 1
    assert b.get_grad() == -1
Exemplo n.º 2
0
def test_minus():
    a = variable.Variables(100)
    b = variable.Variables(10)

    c = Arithmetic.Minus(a, b)
    assert c.forward() == 100 - 10