提交 a6c3723c authored 作者: Frederic's avatar Frederic

remove print in tests.

上级 d12b3db2
...@@ -13,7 +13,7 @@ import unittest ...@@ -13,7 +13,7 @@ import unittest
def test0(): def test0():
x = theano.tensor.dvector() x = theano.tensor.dvector()
f = theano.function([x], ((2. * x) + 7) / 2., mode=debugmode.DebugMode()) f = theano.function([x], ((2. * x) + 7) / 2., mode=debugmode.DebugMode())
print f([1, 2]) f([1, 2])
class BROKEN_ON_PURPOSE_Add(gof.Op): class BROKEN_ON_PURPOSE_Add(gof.Op):
...@@ -671,8 +671,8 @@ class Test_preallocated_output(unittest.TestCase): ...@@ -671,8 +671,8 @@ class Test_preallocated_output(unittest.TestCase):
f = theano.function([a, b], out, mode='DEBUG_MODE') f = theano.function([a, b], out, mode='DEBUG_MODE')
out_val = f(a_val, b_val) out_val = f(a_val, b_val)
print 'out_val =', out_val #print 'out_val =', out_val
print out_val.strides #print out_val.strides
# Should work for now (0.4.0), because the C thunk does not care # Should work for now (0.4.0), because the C thunk does not care
# at all of what is in storage_map initially. # at all of what is in storage_map initially.
...@@ -682,8 +682,8 @@ class Test_preallocated_output(unittest.TestCase): ...@@ -682,8 +682,8 @@ class Test_preallocated_output(unittest.TestCase):
f = theano.function([a, b], out, mode='DEBUG_MODE') f = theano.function([a, b], out, mode='DEBUG_MODE')
out_val = f(a_val, b_val) out_val = f(a_val, b_val)
print 'out_val =', out_val #print 'out_val =', out_val
print out_val.strides #print out_val.strides
finally: finally:
config.DebugMode.check_preallocated_output = init_conf_val config.DebugMode.check_preallocated_output = init_conf_val
...@@ -307,7 +307,7 @@ class T_function(unittest.TestCase): ...@@ -307,7 +307,7 @@ class T_function(unittest.TestCase):
def test_constant_output(self): def test_constant_output(self):
# Test that if the output is a constant, we respect the theano memory interface # Test that if the output is a constant, we respect the theano memory interface
f = theano.function([],theano.tensor.constant([4])) f = theano.function([],theano.tensor.constant([4]))
print f.maker.env.toposort() #print f.maker.env.toposort()
out = f() out = f()
assert (out==4).all() assert (out==4).all()
out[0]=3 out[0]=3
...@@ -318,7 +318,7 @@ class T_function(unittest.TestCase): ...@@ -318,7 +318,7 @@ class T_function(unittest.TestCase):
# Test that if the output is a constant and borrow, we respect the theano memory interface # Test that if the output is a constant and borrow, we respect the theano memory interface
f = theano.function([],Out(theano.tensor.constant([4]), borrow=True)) f = theano.function([],Out(theano.tensor.constant([4]), borrow=True))
print f.maker.env.toposort() #print f.maker.env.toposort()
out = f() out = f()
assert (out==4).all() assert (out==4).all()
out[0]=3 out[0]=3
...@@ -412,8 +412,8 @@ class T_picklefunction(unittest.TestCase): ...@@ -412,8 +412,8 @@ class T_picklefunction(unittest.TestCase):
self.assertFalse(x in g.container) self.assertFalse(x in g.container)
self.assertFalse(x in g.value) self.assertFalse(x in g.value)
self.assertTrue(len(f.defaults) == len(g.defaults)) self.assertTrue(len(f.defaults) == len(g.defaults))
print 'f.defaults = %s' % (f.defaults, ) #print 'f.defaults = %s' % (f.defaults, )
print 'g.defaults = %s' % (g.defaults, ) #print 'g.defaults = %s' % (g.defaults, )
self.assertTrue(all([f_req == g_req and f_feed == g_feed and self.assertTrue(all([f_req == g_req and f_feed == g_feed and
f_val == g_val f_val == g_val
for ((f_req, f_feed, f_val), (g_req, g_feed, g_val)) in zip( for ((f_req, f_feed, f_val), (g_req, g_feed, g_val)) in zip(
......
...@@ -187,7 +187,7 @@ class ExampleRNN(Module): ...@@ -187,7 +187,7 @@ class ExampleRNN(Module):
self.minimizer = minimizer([x, y], self.cost, self.params) self.minimizer = minimizer([x, y], self.cost, self.params)
def _instance_initialize(self, obj): def _instance_initialize(self, obj):
print 'INITIALIZE EXAMPLE RNN' #print 'INITIALIZE EXAMPLE RNN'
n_vis = self.n_vis n_vis = self.n_vis
rng = N.random.RandomState(unittest_tools.fetch_seed(2342)) rng = N.random.RandomState(unittest_tools.fetch_seed(2342))
...@@ -214,7 +214,7 @@ def test_example_rnn(): ...@@ -214,7 +214,7 @@ def test_example_rnn():
LAG = 4 LAG = 4
y[LAG:] = x[:-LAG, 0:n_out] y[LAG:] = x[:-LAG, 0:n_out]
if 1: if 0:
for i, node in enumerate(rnn.minimizer.step_cost.maker.env.toposort()): for i, node in enumerate(rnn.minimizer.step_cost.maker.env.toposort()):
print i, node print i, node
...@@ -223,9 +223,6 @@ def test_example_rnn(): ...@@ -223,9 +223,6 @@ def test_example_rnn():
niter=30 niter=30
for i in xrange(niter): for i in xrange(niter):
if i % 100 == 0:
print i, rnn.minimizer.step_cost(x, y), rnn.minimizer.stepsize
else:
rnn.minimizer.step_cost(x, y) rnn.minimizer.step_cost(x, y)
if theano.config.mode=='DEBUG_MODE': if theano.config.mode=='DEBUG_MODE':
assert rnn.minimizer.step_cost(x,y) < -.9 #it starts around -.28 assert rnn.minimizer.step_cost(x,y) < -.9 #it starts around -.28
...@@ -258,7 +255,7 @@ def test_WEIRD_STUFF(): ...@@ -258,7 +255,7 @@ def test_WEIRD_STUFF():
# rnn2 = rnn_module1.make(mode=Mode('c|py', 'fast_run').excluding("inplace_opt"))#work # rnn2 = rnn_module1.make(mode=Mode('c|py', 'fast_run').excluding("inplace_opt"))#work
# rnn2 = rnn_module1.make(mode=Mode('py', 'fast_run'))#fail # rnn2 = rnn_module1.make(mode=Mode('py', 'fast_run'))#fail
m = Mode('py', 'fast_run') m = Mode('py', 'fast_run')
for n in m.optimizer: print n.name # for n in m.optimizer: print n.name
if 0: if 0:
topo1=rnn1.minimizer.step_cost.maker.env.toposort() topo1=rnn1.minimizer.step_cost.maker.env.toposort()
...@@ -266,7 +263,7 @@ def test_WEIRD_STUFF(): ...@@ -266,7 +263,7 @@ def test_WEIRD_STUFF():
for i in range(len(topo1)): for i in range(len(topo1)):
print '1',i, topo1[i] print '1',i, topo1[i]
print '2',i, topo2[i] print '2',i, topo2[i]
if 1: if 0:
topo1=rnn1.minimizer.step.maker.env.toposort() topo1=rnn1.minimizer.step.maker.env.toposort()
topo2=rnn2.minimizer.step.maker.env.toposort() topo2=rnn2.minimizer.step.maker.env.toposort()
for i in range(len(topo1)): for i in range(len(topo1)):
...@@ -274,10 +271,10 @@ def test_WEIRD_STUFF(): ...@@ -274,10 +271,10 @@ def test_WEIRD_STUFF():
print '2',i, topo2[i] print '2',i, topo2[i]
import theano.printing import theano.printing
print len(rnn1.minimizer.step.maker.inputs) #print len(rnn1.minimizer.step.maker.inputs)
print len(rnn2.minimizer.step.maker.inputs) #print len(rnn2.minimizer.step.maker.inputs)
print rnn1.minimizer.step.maker.inputs #print rnn1.minimizer.step.maker.inputs
print rnn2.minimizer.step.maker.inputs #print rnn2.minimizer.step.maker.inputs
...@@ -293,15 +290,15 @@ def test_WEIRD_STUFF(): ...@@ -293,15 +290,15 @@ def test_WEIRD_STUFF():
niter=3 niter=3
for i in xrange(niter): for i in xrange(niter):
print rnn1.minimizer.step_cost(x, y) #print rnn1.minimizer.step_cost(x, y)
print rnn2.minimizer.step_cost(x, y) #print rnn2.minimizer.step_cost(x, y)
# assert rnn1.n_vis != rnn2.n_vis or slef.n_hid != rnn2.n_hid or rnn1.n_out != rnn2.n_out # assert rnn1.n_vis != rnn2.n_vis or slef.n_hid != rnn2.n_hid or rnn1.n_out != rnn2.n_out
assert (N.abs(rnn1.z0-rnn2.z0)<1e-8).all() assert (N.abs(rnn1.z0-rnn2.z0)<1e-8).all()
print (N.abs(rnn1.w-rnn2.w)<1e-8).all() #print (N.abs(rnn1.w-rnn2.w)<1e-8).all()
print (N.abs(rnn1.w-rnn2.w)) #print (N.abs(rnn1.w-rnn2.w))
print rnn1.w #print rnn1.w
print rnn2.w #print rnn2.w
assert (N.abs(rnn1.w-rnn2.w)<1e-8).all() assert (N.abs(rnn1.w-rnn2.w)<1e-8).all()
# assert b # assert b
......
...@@ -32,7 +32,7 @@ class T_bunch_of_modes(unittest.TestCase): ...@@ -32,7 +32,7 @@ class T_bunch_of_modes(unittest.TestCase):
# test that it runs something # test that it runs something
f([[1, 2], [3, 4]], [5, 6]) f([[1, 2], [3, 4]], [5, 6])
linker_classes_involved.append(f.maker.mode.linker.__class__) linker_classes_involved.append(f.maker.mode.linker.__class__)
print 'MODE:', mode, f.maker.mode.linker, 'stop' # print 'MODE:', mode, f.maker.mode.linker, 'stop'
# regression check: # regression check:
# there should be # there should be
# - VM_Linker # - VM_Linker
......
...@@ -74,10 +74,10 @@ def test_speed(): ...@@ -74,10 +74,10 @@ def test_speed():
numpy_version(x, steps_a) numpy_version(x, steps_a)
t0 = time.time() t0 = time.time()
print numpy_version(x, steps_a) #print numpy_version(x, steps_a)
t1 = time.time() t1 = time.time()
t2 = time.time() t2 = time.time()
print numpy_version(x, steps_b) #print numpy_version(x, steps_b)
t3 = time.time() t3 = time.time()
t_a = t1 - t0 t_a = t1 - t0
t_b = t3 - t2 t_b = t3 - t2
...@@ -103,15 +103,15 @@ def test_speed(): ...@@ -103,15 +103,15 @@ def test_speed():
#profile='f_b speed test %s'%name, #profile='f_b speed test %s'%name,
) )
print f_a([2.0, 3.0]) f_a([2.0, 3.0])
t0 = time.time() t0 = time.time()
print f_a([2.0, 3.0]) f_a([2.0, 3.0])
t1 = time.time() t1 = time.time()
print f_b([2.0, 3.0]) f_b([2.0, 3.0])
t2 = time.time() t2 = time.time()
print f_b([2.0, 3.0]) f_b([2.0, 3.0])
t3 = time.time() t3 = time.time()
t_a = t1 - t0 t_a = t1 - t0
...@@ -155,15 +155,15 @@ def test_speed_lazy(): ...@@ -155,15 +155,15 @@ def test_speed_lazy():
#profile='f_b lazy ifelse %s'%name, #profile='f_b lazy ifelse %s'%name,
) )
print f_a([2.0]) f_a([2.0])
t0 = time.time() t0 = time.time()
print f_a([2.0]) f_a([2.0])
t1 = time.time() t1 = time.time()
print f_b([2.0]) f_b([2.0])
t2 = time.time() t2 = time.time()
print f_b([2.0]) f_b([2.0])
t3 = time.time() t3 = time.time()
t_a = t1 - t0 t_a = t1 - t0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论