提交 5369ad60 authored 作者: Frederic Bastien's avatar Frederic Bastien

added speed test for the new generalized collapse of dimensions.

上级 5bf606c4
......@@ -124,7 +124,7 @@ def test_elemwise4():
def speed_elemwise_collapse():
""" used to time if the collapse of ccontiguous row are usefull """
""" used to time if the collapse of ccontiguous dims are usefull """
shape = (30,40,50,600)
a = cuda_ndarray.CudaNdarray(numpy.asarray(numpy.random.rand(*shape),dtype='float32'))
......@@ -147,6 +147,30 @@ def speed_elemwise_collapse():
f(v)
t2=time.time()
def speed_elemwise_collapse2():
""" used to test the speed up of the generalised collapse of ccontiguous dims"""
shape = (30,40,50,600)
a = cuda_ndarray.CudaNdarray(numpy.asarray(numpy.random.rand(*shape),dtype='float32'))
a = numpy.asarray(numpy.random.rand(*shape),dtype='float32')
a2 = tcn.shared_constructor(a, 'a')
a3 = a2[:,:,:,::2]
b = tcn.CudaNdarrayType((False, False, False, False))()
c = a3+b * tensor.exp(1 + b**a3)
f = pfunc([b], [c])
v = numpy.asarray(numpy.random.rand(*shape),dtype='float32')
v = v[:,:,:,::2]
v=cuda_ndarray.CudaNdarray(v)
for id,n in enumerate(f.maker.env.toposort()):
print id, n
t1=time.time()
for i in range(100):
#let debugmode catch errors
f(v)
t2=time.time()
def test_elemwise_collapse():
""" used to test if the case where all inputs are broadcast """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论