提交 b725ce72 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix huge amount of whitespace in between function arguments in tests.

上级 10efa2bf
...@@ -882,9 +882,9 @@ if 0: # old code still to be ported from ProfileMode ...@@ -882,9 +882,9 @@ if 0: # old code still to be ported from ProfileMode
print 'Theano fct call %.3fs %.1f%%' % (total_fct_time, print 'Theano fct call %.3fs %.1f%%' % (total_fct_time,
total_fct_time / total_time * total_fct_time / total_time *
100) 100)
print ' Theano Op time (included in fct call, Time spent running thunks) %.3fs %.1f%%(of total) %.1f%%(of fct call)' % (local_time, print ' Theano Op time (included in fct call, Time spent ' \
local_time / total_time * 100, 'running thunks) %.3fs %.1f%%(of total) %.1f%%(of fct call)' % \
time_pr_in_fct) (local_time, local_time / total_time * 100, time_pr_in_fct)
print 'Other time since import %.3fs %.1f%%'%(other_time,other_time/total_time*100) print 'Other time since import %.3fs %.1f%%'%(other_time,other_time/total_time*100)
print '%i Theano fct call, %.3fs per call'%(total_fct_call, time_per_call) print '%i Theano fct call, %.3fs per call'%(total_fct_call, time_per_call)
......
...@@ -326,13 +326,11 @@ class test_canonize(unittest.TestCase): ...@@ -326,13 +326,11 @@ class test_canonize(unittest.TestCase):
fxv = theano._asarray(numpy.random.rand(*shp), dtype='float32') fxv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
fyv = theano._asarray(numpy.random.rand(*shp), dtype='float32') fyv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
fzv = theano._asarray(numpy.random.rand(*shp), dtype='float32') fzv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
fvv = theano._asarray(numpy.random.rand(shp[0]), dtype= fvv = theano._asarray(numpy.random.rand(shp[0]), dtype='float32').reshape(1, shp[0])
'float32').reshape(1, shp[0])
dxv = theano._asarray(numpy.random.rand(*shp), dtype='float64') dxv = theano._asarray(numpy.random.rand(*shp), dtype='float64')
dyv = theano._asarray(numpy.random.rand(*shp), dtype='float64') dyv = theano._asarray(numpy.random.rand(*shp), dtype='float64')
dzv = theano._asarray(numpy.random.rand(*shp), dtype='float64') dzv = theano._asarray(numpy.random.rand(*shp), dtype='float64')
dvv = theano._asarray(numpy.random.rand(shp[0]), dtype= dvv = theano._asarray(numpy.random.rand(shp[0]), dtype='float64').reshape(1, shp[0])
'float64').reshape(1, shp[0])
cases = [ cases = [
(fx + fy, (fx, fy), (fxv, fyv), 1, 'float32'), (fx + fy, (fx, fy), (fxv, fyv), 1, 'float32'),
(fx * fy, (fx, fy), (fxv, fyv), 1, 'float32'), (fx * fy, (fx, fy), (fxv, fyv), 1, 'float32'),
...@@ -433,14 +431,12 @@ class test_canonize(unittest.TestCase): ...@@ -433,14 +431,12 @@ class test_canonize(unittest.TestCase):
fyv = theano._asarray(numpy.random.rand(*shp), dtype='float32') fyv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
fzv = theano._asarray(numpy.random.rand(*shp), dtype='float32') fzv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
fwv = theano._asarray(numpy.random.rand(*shp), dtype='float32') fwv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
fvv = theano._asarray(numpy.random.rand(shp[0]), dtype= fvv = theano._asarray(numpy.random.rand(shp[0]), dtype='float32').reshape(1, shp[0])
'float32').reshape(1, shp[0])
dxv = theano._asarray(numpy.random.rand(*shp), dtype='float64') dxv = theano._asarray(numpy.random.rand(*shp), dtype='float64')
dyv = theano._asarray(numpy.random.rand(*shp), dtype='float64') dyv = theano._asarray(numpy.random.rand(*shp), dtype='float64')
dzv = theano._asarray(numpy.random.rand(*shp), dtype='float64') dzv = theano._asarray(numpy.random.rand(*shp), dtype='float64')
dwv = theano._asarray(numpy.random.rand(*shp), dtype='float64') dwv = theano._asarray(numpy.random.rand(*shp), dtype='float64')
dvv = theano._asarray(numpy.random.rand(shp[0]), dtype= dvv = theano._asarray(numpy.random.rand(shp[0]), dtype='float64').reshape(1, shp[0])
'float64').reshape(1, shp[0])
#We must be sure that the Canonizer is working, but that we don't have other #We must be sure that the Canonizer is working, but that we don't have other
# optimisation that could hide bug in the Canonizer as local_elemwise_fusion # optimisation that could hide bug in the Canonizer as local_elemwise_fusion
...@@ -695,8 +691,7 @@ class test_canonize(unittest.TestCase): ...@@ -695,8 +691,7 @@ class test_canonize(unittest.TestCase):
dxv = theano._asarray(numpy.random.rand(*shp), dtype='float32') dxv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
dyv = theano._asarray(numpy.random.rand(*shp), dtype='float32') dyv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
dzv = theano._asarray(numpy.random.rand(*shp), dtype='float32') dzv = theano._asarray(numpy.random.rand(*shp), dtype='float32')
fvv = theano._asarray(numpy.random.rand(shp[0]), dtype= fvv = theano._asarray(numpy.random.rand(shp[0]), dtype='float32').reshape(1, shp[0])
'float32').reshape(1, shp[0])
#We must be sure that the Canonizer is working, but that we don't have other #We must be sure that the Canonizer is working, but that we don't have other
# optimisation that could hide bug in the Canonizer as local_elemwise_fusion # optimisation that could hide bug in the Canonizer as local_elemwise_fusion
mode = compile.mode.get_default_mode() mode = compile.mode.get_default_mode()
...@@ -1217,8 +1212,10 @@ class test_fusion(unittest.TestCase): ...@@ -1217,8 +1212,10 @@ class test_fusion(unittest.TestCase):
mode2 = copy.copy(compile.get_default_mode()) mode2 = copy.copy(compile.get_default_mode())
mode2._optimizer = mode2._optimizer.excluding('local_elemwise_fusion') mode2._optimizer = mode2._optimizer.excluding('local_elemwise_fusion')
print "test with linker", str(mode1.linker) print "test with linker", str(mode1.linker)
times1 = self.do(mode1, shared_fn, shp, gpu=gpu, nb_repeat= nb_repeat, assert_len_topo=False, slice=s) times1 = self.do(mode1, shared_fn, shp, gpu=gpu, nb_repeat=nb_repeat,
times2 = self.do(mode2, shared_fn, shp, gpu=gpu, nb_repeat= nb_repeat, assert_len_topo=False, slice=s) assert_len_topo=False, slice=s)
times2 = self.do(mode2, shared_fn, shp, gpu=gpu, nb_repeat=nb_repeat,
assert_len_topo=False, slice=s)
print "times1 with local_elemwise_fusion" print "times1 with local_elemwise_fusion"
print times1, times1.min(), times1.max(), times1.sum() print times1, times1.min(), times1.max(), times1.sum()
print "times2 without local_elemwise_fusion" print "times2 without local_elemwise_fusion"
...@@ -1256,11 +1253,12 @@ class test_fusion(unittest.TestCase): ...@@ -1256,11 +1253,12 @@ class test_fusion(unittest.TestCase):
linker = gof.OpWiseCLinker linker = gof.OpWiseCLinker
mode = compile.Mode(linker(), copy.copy(compile.mode.OPT_FAST_RUN)) mode = compile.Mode(linker(), copy.copy(compile.mode.OPT_FAST_RUN))
mode = compile.ProfileMode() mode = compile.ProfileMode()
print "time", self.do(mode, shared, shp=(1000, 1000), gpu= print "time", self.do(mode, shared, shp=(1000, 1000), gpu=False,
False, assert_len_topo=False, slice=s, nb_repeat=100) assert_len_topo=False, slice=s, nb_repeat=100)
def tes_memory_leak(self, mode=compile.mode.Mode('c', 'merge'), shared_fn=shared, shp=(3000,3000), gpu=False, nb_repeat=30, assert_len_topo=True, slice=None): def tes_memory_leak(self, mode=compile.mode.Mode('c', 'merge'),
shared_fn=shared, shp=(3000,3000), gpu=False,
nb_repeat=30, assert_len_topo=True, slice=None):
""" """
param shared_fn: if None, will use compile.function param shared_fn: if None, will use compile.function
verify that the elemwise fusion work verify that the elemwise fusion work
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论