提交 8ee56ae2 authored 作者: Frederic Bastien's avatar Frederic Bastien

added test for the shape of CudaNdarray.

上级 50ef355b
...@@ -40,6 +40,18 @@ def test_shape_i(): ...@@ -40,6 +40,18 @@ def test_shape_i():
assert len(topo)==1 assert len(topo)==1
assert isinstance(topo[0].op,T.opt.Shape_i) assert isinstance(topo[0].op,T.opt.Shape_i)
def test_shape():
x = cuda.ftensor3()
v = cuda.CudaNdarray(numpy.zeros((3,4,5),dtype='float32'))
f = theano.function([x],x.shape)
topo = f.maker.env.toposort()
assert numpy.all(f(v)==(3,4,5))
if theano.config.mode!='FAST_COMPILE':
assert len(topo)==4
assert isinstance(topo[0].op,T.opt.Shape_i)
assert isinstance(topo[1].op,T.opt.Shape_i)
assert isinstance(topo[2].op,T.opt.Shape_i)
assert isinstance(topo[3].op,T.opt.MakeVector)
def test_softmax_optimizations(): def test_softmax_optimizations():
from theano.tensor.nnet.nnet import softmax, crossentropy_categorical_1hot, crossentropy_softmax_argmax_1hot_with_bias from theano.tensor.nnet.nnet import softmax, crossentropy_categorical_1hot, crossentropy_softmax_argmax_1hot_with_bias
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论