예제 #1
0
 def test_softmax_grad():
     from arsenal.maths.checkgrad import fdcheck
     n = 20
     adj = np.random.uniform(-1, 1, size=n)
     x = np.random.uniform(-1, 1, size=n)
     out = softmax(x)
     g = d_softmax(out, x, adj)
     fdcheck(lambda: softmax(x).dot(adj), x, g)
예제 #2
0
파일: util.py 프로젝트: timvieira/arsenal
 def test_softmax_grad():
     from arsenal.maths.checkgrad import fdcheck
     n = 20
     adj = np.random.uniform(-1,1,size=n)
     x = np.random.uniform(-1,1,size=n)
     out = softmax(x)
     g = d_softmax(out, x, adj)
     fdcheck(lambda: softmax(x).dot(adj), x, g)