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)
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)