提交 0156327d authored 作者: Frederic's avatar Frederic

remove print in tests.

上级 a6c3723c
......@@ -22,9 +22,9 @@ class T_OpFromGraph(unittest.TestCase):
xv = numpy.ones((2, 2), dtype=config.floatX)
yv = numpy.ones((2, 2), dtype=config.floatX)*3
zv = numpy.ones((2, 2), dtype=config.floatX)*5
print function, function.__module__
print fn.maker.env.toposort()
print fn(xv, yv, zv)
#print function, function.__module__
#print fn.maker.env.toposort()
fn(xv, yv, zv)
assert numpy.all(8.0 == fn(xv, yv, zv))
assert numpy.all(8.0 == fn(xv, yv, zv))
......
......@@ -211,7 +211,7 @@ def test_badclinkeroutput():
try:
f_inconsistent([1.0, 2.0, 3.0], [2, 3, 4])
except debugmode.BadCLinkerOutput, e:
print repr(e)
#print repr(e)
assert e.r.owner.op is inconsistent
return # TEST PASS
......@@ -490,7 +490,7 @@ class Test_ViewMap(unittest.TestCase):
f([1, 2, 3, 4], [5, 6, 7, 8])
assert False # DebugMode should have caught the error
except debugmode.BadViewMap, e:
print e
#print e
pass
# the situation can be rescued by picking one of the inputs and
......@@ -554,7 +554,7 @@ class Test_check_isfinite(unittest.TestCase):
#inf should go through
infs = numpy.asarray([1.0, 1., 1.]) / 0
print infs
#print infs
f(infs)
return
......@@ -576,11 +576,11 @@ class BrokenCImplementationAdd(gof.Op):
return r
def perform(self, node, inp, out_):
print 'executing python perform'
#print 'executing python perform'
a, b = inp
out, = out_
z = a + b
print 'out[0] was:', out[0]
#print 'out[0] was:', out[0]
out[0] = z
def c_code_cache_version(self):
......
......@@ -18,7 +18,7 @@ class NNet(object):
self.lr = shared(lr, 'learning_rate')
self.w1 = shared(numpy.zeros((n_hidden, n_input)), 'w1')
self.w2 = shared(numpy.zeros((n_output, n_hidden)), 'w2')
print self.lr.type
#print self.lr.type
self.hidden = sigmoid(tensor.dot(self.w1, self.input))
self.output = tensor.dot(self.w2, self.hidden)
......@@ -51,7 +51,7 @@ class TestNnet(unittest.TestCase):
output, cost = nnet.sgd_step(input, target)
mean_cost += cost
mean_cost /= float(len(data))
print 'Mean cost at epoch %s: %s' % (epoch, mean_cost)
#print 'Mean cost at epoch %s: %s' % (epoch, mean_cost)
self.assertTrue(abs(mean_cost - 0.20588975452) < 1e-6)
# Just call functions to make sure they do not crash.
out = nnet.compute_output(input)
......
......@@ -146,7 +146,7 @@ class T_module(unittest.TestCase):
#assign 4 and 5 to the two variables' containers in m
m.l = [4, 5]
print 'm.f', m.f()
m.f()
assert numpy.all(5 == m.f())
assert numpy.all(4 == m.g())
......@@ -189,9 +189,9 @@ class T_module(unittest.TestCase):
assert 5 == m.f()
assert 4 == m.g()
print 'dscalar test'
#print 'dscalar test'
local_test(lambda:T.dscalar(),lambda:T.dscalar())
print 'value test'
#print 'value test'
local_test(lambda:T.value(1),lambda:T.value(2))
......@@ -494,9 +494,9 @@ class T_module(unittest.TestCase):
M.a = [1,2,3]
M.make()
m = M.make()
print m.a
print m.a[0], type(m.a[0]), m.a[0] == 1
print list(m.a)
#print m.a
#print m.a[0], type(m.a[0]), m.a[0] == 1
#print list(m.a)
assert list(m.a) == [1,2,3]
assert m.a is not M.a
try:
......@@ -545,7 +545,8 @@ def test_multiple_references():
self.sub_module = sub_module
def _instance_initialize(self, obj):
print 'Initializing A'
pass
#print 'Initializing A'
class B(theano.Module):
......@@ -555,7 +556,8 @@ def test_multiple_references():
self.sub_module = sub_module
def _instance_initialize(self, obj):
print 'Initializing B'
pass
#print 'Initializing B'
class C(theano.Module):
......@@ -565,11 +567,11 @@ def test_multiple_references():
self.value = theano.tensor.scalar()
def _instance_initialize(self, obj):
print 'Initializing C'
#print 'Initializing C'
obj.value = 0
def _instance_set(self, obj, value):
print 'Setting C'
#print 'Setting C'
obj.value = value
......@@ -584,7 +586,7 @@ def test_multiple_references():
self.bug = theano.tensor.scalar()
def _instance_initialize(self, obj):
print 'Initializing D'
#print 'Initializing D'
obj.c.set(1)
......
......@@ -369,7 +369,6 @@ class Test_pfunc(unittest.TestCase):
z: (((x * 5) + y) ** z)})
up()
print x.get_value(borrow=True)
assert numpy.all(x.get_value() == 20)
assert numpy.all(y.get_value() == 24)
assert numpy.all(z.get_value() == (24 ** 2))
......@@ -380,7 +379,6 @@ class Test_pfunc(unittest.TestCase):
f = pfunc([], [x])
f()
print x.get_value()
assert x.get_value() == 1
del x.default_update
......@@ -399,32 +397,26 @@ class Test_pfunc(unittest.TestCase):
# Test that the default update is taken into account in the right cases
f1 = pfunc([], [x], no_default_updates=True)
f1()
print x.get_value()
assert x.get_value() == 0
f2 = pfunc([], [x], no_default_updates=[x])
f2()
print x.get_value()
assert x.get_value() == 0
f3 = pfunc([], [x], no_default_updates=[x, y])
f3()
print x.get_value()
assert x.get_value() == 0
f4 = pfunc([], [x], no_default_updates=[y])
f4()
print x.get_value()
assert x.get_value() == 2
f5 = pfunc([], [x], no_default_updates=[])
f5()
print x.get_value()
assert x.get_value() == 4
f5 = pfunc([], [x], no_default_updates=False)
f5()
print x.get_value()
assert x.get_value() == 6
self.assertRaises(TypeError, pfunc, [], [x], no_default_updates=(x))
......@@ -435,32 +427,26 @@ class Test_pfunc(unittest.TestCase):
# Mix explicit updates and no_default_updates
g1 = pfunc([], [x], updates=[(x, (x - 1))], no_default_updates=True)
g1()
print x.get_value()
assert x.get_value() == 5
g2 = pfunc([], [x], updates=[(x, (x - 1))], no_default_updates=[x])
g2()
print x.get_value()
assert x.get_value() == 4
g3 = pfunc([], [x], updates=[(x, (x - 1))], no_default_updates=[x, y])
g3()
print x.get_value()
assert x.get_value() == 3
g4 = pfunc([], [x], updates=[(x, (x - 1))], no_default_updates=[y])
g4()
print x.get_value()
assert x.get_value() == 2
g5 = pfunc([], [x], updates=[(x, (x - 1))], no_default_updates=[])
g5()
print x.get_value()
assert x.get_value() == 1
g5 = pfunc([], [x], updates=[(x, (x - 1))], no_default_updates=False)
g5()
print x.get_value()
assert x.get_value() == 0
def test_default_updates_expressions(self):
......@@ -473,17 +459,14 @@ class Test_pfunc(unittest.TestCase):
f1 = pfunc([a], z)
f1(12)
print x
assert x.get_value() == 1
f2 = pfunc([a], z, no_default_updates=True)
assert f2(7) == 7
print x
assert x.get_value() == 1
f3 = pfunc([a], z, no_default_updates=[x])
assert f3(9) == 9
print x
assert x.get_value() == 1
def test_default_updates_multiple(self):
......@@ -524,7 +507,6 @@ class Test_pfunc(unittest.TestCase):
f1 = pfunc([], [x])
f1()
print x.get_value(), y.get_value(), z.get_value()
assert x.get_value() == 1
assert y.get_value() == -1
assert z.get_value() == -2
......@@ -598,10 +580,8 @@ class Test_pfunc(unittest.TestCase):
b = 2 * a
# Use only the tip of the graph, a is not used
f = pfunc([b], b)
print 'a.get_value() =', a.get_value()
assert a.get_value() == 0
f(21)
print 'a.get_value() =', a.get_value()
assert a.get_value() == 0
def test_givens_replaces_shared_variable(self):
......@@ -917,7 +897,7 @@ class Test_aliasing_rules(unittest.TestCase):
data_of_b = data_of(B)
f = pfunc([], [], updates=[(A, B[:, ::-1]), (B, A.T)])
theano.printing.debugprint(f)
#theano.printing.debugprint(f)
f()
# correctness (doesn't actually test the view...)
assert numpy.all(data_of(A) == -.5)
......@@ -938,7 +918,6 @@ class Test_aliasing_rules(unittest.TestCase):
assert numpy.all(data_of(B) < 5)
data_of_a += 10
print data_of(B)
assert numpy.all(data_of(B) > 5)
data_of_a -= 10
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论