Пример #1
0
def test_gpu_node_swish(a):
    set_cuda_active(True)

    g1 = Variable(a)

    g3 = rm.sum(rm.swish(g1))
    g = g3.grad()
    g_g1 = g.get(g1)
    g3.to_cpu()

    set_cuda_active(False)
    c3 = rm.sum(rm.swish(g1))
    c = c3.grad()
    c_g1 = c.get(g1)

    close(g3, c3)
    close(c_g1, g_g1)
Пример #2
0
 def func(node):
     return sum(rm.swish(node))