提交 2e7311dc authored 作者: Frederic Bastien's avatar Frederic Bastien

added test for gpusoftmax

上级 cb6f77cf
...@@ -51,6 +51,16 @@ def test_int_pow(): ...@@ -51,6 +51,16 @@ def test_int_pow():
#theano.printing.debugprint(f) #theano.printing.debugprint(f)
def test_softmax():
x = tensor.fmatrix()
f = theano.function([x],tensor.nnet.nnet.Softmax()(x), mode=mode_with_gpu)
f2 = theano.function([x],tensor.nnet.nnet.Softmax()(x), mode=mode_without_gpu)
assert isinstance(f.maker.env.toposort()[1].op,cuda.nnet.GpuSoftmax)
xv=numpy.random.rand(7,8)
assert numpy.allclose(f(xv),f2(xv))
def test_softmax_with_bias(): def test_softmax_with_bias():
x = tensor.fmatrix() x = tensor.fmatrix()
b = tensor.fvector() b = tensor.fvector()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论