コード例 #1
0
ファイル: util.py プロジェクト: supratikbose/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)
コード例 #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)