Exemple #1
0
def test_grad_refactor_simple_1():
    assert C.grad_all(grad_refactor_simple_1)(2, 1) == (4, 2)
Exemple #2
0
def test_grad_refactor_10():
    """ test_grad_while """
    assert C.grad_all(grad_refactor__while_1)(Tensor(5,
                                                     dtype=ms.int32)) == (60, )
def first_derivative_all(x):
    """ first_derivative_all """
    return grad_all(single)(x)[0]
Exemple #4
0
def test_grad_refactor_4():
    assert C.grad_all(grad_refactor_4)(Tensor(4, dtype=ms.int32)) == (3, )
Exemple #5
0
def test_grad_refactor_6():
    assert C.grad_all(grad_refactor_6)(Tensor(3, dtype=ms.int32),
                                       Tensor(2, dtype=ms.int32)) == (3, 1)
Exemple #6
0
def test_grad_refactor_simple_1():
    assert C.grad_all(grad_refactor_simple_1)(Tensor(2, dtype=ms.int32),
                                              Tensor(1,
                                                     dtype=ms.int32)) == (4, 2)
Exemple #7
0
def test_grad_refactor_2():
    assert C.grad_all(grad_refactor_2)(Tensor(2, dtype=ms.int32),
                                       Tensor(3, dtype=ms.int32)) == (27, 54)
Exemple #8
0
def test_grad_refactor_5():
    assert C.grad_all(grad_refactor_5)(1) == (1, )
Exemple #9
0
def test_grad_refactor_6():
    assert C.grad_all(grad_refactor_6)(3, 2) == (3, 1)
Exemple #10
0
def test_grad_refactor_3():
    assert C.grad_all(grad_refactor_3)(3) == (3, )
Exemple #11
0
def test_grad_refactor_4():
    assert C.grad_all(grad_refactor_4)(4) == (3, )
Exemple #12
0
def test_grad_refactor_2():
    assert C.grad_all(grad_refactor_2)(2, 3) == (27, 54)
Exemple #13
0
def test_grad_refactor_1():
    assert C.grad_all(grad_refactor_1)(2, 3) == (3, 2)
Exemple #14
0
def test_grad_refactor_simple_2():
    assert C.grad_all(grad_refactor_simple_2)(2, 3, 0) == (7, 4, 7)
Exemple #15
0
def grad_while(x):
    """ grad_while """
    return C.grad_all(_while)(x)
Exemple #16
0
def test_grad_refactor_9():
    assert C.grad_all(grad_refactor_while)(3) == (6, )
Exemple #17
0
def grad_for(x):
    """ grad_for """
    return C.grad_all(_for)(x)
Exemple #18
0
def test_grad_refactor_10():
    """ test_grad_while """
    assert C.grad_all(grad_refactor__while_1)(5) == (60, )
Exemple #19
0
def test_grad_refactor_simple_2():
    x = Tensor(2, dtype=ms.int32)
    y = Tensor(3, dtype=ms.int32)
    z = Tensor(0, dtype=ms.int32)
    assert C.grad_all(grad_refactor_simple_2)(x, y, z) == (7, 4, 7)
Exemple #20
0
def test_grad_refactor_14():
    assert C.grad_all(grad_refactor_14)(2, 3) == (3, 9)
Exemple #21
0
 def df_refactor_3(x):
     return C.grad_all(grad_refactor_3)(x)
Exemple #22
0
 def df_refactor_14(x, y):
     return C.grad_all(grad_refactor_14)(x, y)
Exemple #23
0
 def df_refactor_5(x):
     return C.grad_all(grad_refactor_5)(x)
Exemple #24
0
def mainf(x, y):
    """ mainf """
    return C.grad_all(mul)(x, y)
Exemple #25
0
 def df_refactor_while(input_x):
     return C.grad_all(grad_refactor_while)(input_x)
Exemple #26
0
def grad_add_mul(x, y):
    """ grad_add_mul """
    return C.grad_all(add_mul)(x, y)
 def construct(self, x, y, b):
     return C.grad_all(self.network)(x, y, b)
Exemple #28
0
def grad_if(x, y):
    """ grad_if """
    return C.grad_all(if_test)(x, y)
def second_derivative_all(x):
    """ second_derivative_all """
    return grad_all(first_derivative_all)(x)[0]
Exemple #30
0
 def f(x, y):
     return C.grad_all(debug_test)(x, y)