提交 a864aeef authored 作者: Frederic Bastien's avatar Frederic Bastien

separate the grad test to another test.

上级 08578830
...@@ -924,6 +924,10 @@ class Test_softmax_opt(): ...@@ -924,6 +924,10 @@ class Test_softmax_opt():
assert softmax in f_ops assert softmax in f_ops
f(self.rng.rand(3,4)) f(self.rng.rand(3,4))
def test_grad(self):
c = T.matrix()
p_y = T.exp(c) / T.exp(c).sum(axis=1).dimshuffle(0,'x')
# test that function contains softmax and no div. # test that function contains softmax and no div.
w = T.matrix() w = T.matrix()
g = theano.function([c,w],T.grad((p_y*w).sum(), c)) g = theano.function([c,w],T.grad((p_y*w).sum(), c))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论