提交 d44c7f33 authored 作者: James Bergstra's avatar James Bergstra

s/stderr/stdout (in most cases) in cuda tests

上级 5ce32c02
...@@ -140,20 +140,20 @@ def test_elemwise1(): ...@@ -140,20 +140,20 @@ def test_elemwise1():
b = tensor.fmatrix() b = tensor.fmatrix()
#let debugmode catch any mistakes #let debugmode catch any mistakes
print >> sys.stderr, "STARTING FUNCTION 1" print >> sys.stdout, "STARTING FUNCTION 1"
f = pfunc([b], [], updates=[(a, b**a)], mode=mode_with_gpu) f = pfunc([b], [], updates=[(a, b**a)], mode=mode_with_gpu)
for i, node in enumerate(f.maker.env.toposort()): for i, node in enumerate(f.maker.env.toposort()):
print i, node print i, node
f(numpy.random.rand(*shape)+0.3) f(numpy.random.rand(*shape)+0.3)
print >> sys.stderr, "STARTING FUNCTION 2" print >> sys.stdout, "STARTING FUNCTION 2"
#let debugmode catch any mistakes #let debugmode catch any mistakes
f = pfunc([b], [], updates=[(a, tensor.exp(b**a))], mode=mode_with_gpu) f = pfunc([b], [], updates=[(a, tensor.exp(b**a))], mode=mode_with_gpu)
for i, node in enumerate(f.maker.env.toposort()): for i, node in enumerate(f.maker.env.toposort()):
print i, node print i, node
f(numpy.random.rand(*shape)+0.3) f(numpy.random.rand(*shape)+0.3)
print >> sys.stderr, "STARTING FUNCTION 3" print >> sys.stdout, "STARTING FUNCTION 3"
#let debugmode catch any mistakes #let debugmode catch any mistakes
f = pfunc([b], [], updates=[(a, a+b * tensor.exp(b**a))], mode=mode_with_gpu) f = pfunc([b], [], updates=[(a, a+b * tensor.exp(b**a))], mode=mode_with_gpu)
f(numpy.random.rand(*shape)+0.3) f(numpy.random.rand(*shape)+0.3)
...@@ -169,11 +169,11 @@ def test_elemwise2(): ...@@ -169,11 +169,11 @@ def test_elemwise2():
f = pfunc([b], [], updates=[(a, (a+b).dimshuffle(pattern))], mode=mode_with_gpu) f = pfunc([b], [], updates=[(a, (a+b).dimshuffle(pattern))], mode=mode_with_gpu)
has_elemwise = False has_elemwise = False
for i, node in enumerate(f.maker.env.toposort()): for i, node in enumerate(f.maker.env.toposort()):
print >> sys.stderr, i, node print >> sys.stdout, i, node
has_elemwise = has_elemwise or isinstance(node.op, tensor.Elemwise) has_elemwise = has_elemwise or isinstance(node.op, tensor.Elemwise)
assert not has_elemwise assert not has_elemwise
#let debugmode catch errors #let debugmode catch errors
print >> sys.stderr, 'pattern', pattern print >> sys.stdout, 'pattern', pattern
f(rng.rand(*shape)*.3) f(rng.rand(*shape)*.3)
shape = (3,4,5,6) shape = (3,4,5,6)
...@@ -204,7 +204,7 @@ def test_elemwise3(): ...@@ -204,7 +204,7 @@ def test_elemwise3():
b**a).dimshuffle([2,0,3,1]))], mode=mode_with_gpu) b**a).dimshuffle([2,0,3,1]))], mode=mode_with_gpu)
has_elemwise = False has_elemwise = False
for i, node in enumerate(f.maker.env.toposort()): for i, node in enumerate(f.maker.env.toposort()):
print >> sys.stderr, i, node print >> sys.stdout, i, node
has_elemwise = has_elemwise or isinstance(node.op, tensor.Elemwise) has_elemwise = has_elemwise or isinstance(node.op, tensor.Elemwise)
assert not has_elemwise assert not has_elemwise
#let debugmode catch errors #let debugmode catch errors
...@@ -220,7 +220,7 @@ def test_elemwise4(): ...@@ -220,7 +220,7 @@ def test_elemwise4():
f = pfunc([b,c], [], updates=[(a, (a+b.dimshuffle('x', 0)*c.dimshuffle(0, 'x')))], mode=mode_with_gpu) f = pfunc([b,c], [], updates=[(a, (a+b.dimshuffle('x', 0)*c.dimshuffle(0, 'x')))], mode=mode_with_gpu)
has_elemwise = False has_elemwise = False
for i, node in enumerate(f.maker.env.toposort()): for i, node in enumerate(f.maker.env.toposort()):
print >> sys.stderr, i, node print >> sys.stdout, i, node
has_elemwise = has_elemwise or isinstance(node.op, tensor.Elemwise) has_elemwise = has_elemwise or isinstance(node.op, tensor.Elemwise)
assert not has_elemwise assert not has_elemwise
#let debugmode catch errors #let debugmode catch errors
......
...@@ -360,7 +360,7 @@ def test_subsample(): ...@@ -360,7 +360,7 @@ def test_subsample():
def test_logical_shapes(): def test_logical_shapes():
# implement when # implement when
print >> sys.stderr, "INFO: test_logical_shapes not implemented (i.e. imshp_logical, kshp_logical, kshp_logical_top_aligned)" print >> sys.stderr, "WARNING TODO: test_logical_shapes not implemented (i.e. imshp_logical, kshp_logical, kshp_logical_top_aligned)"
def _test_dummy(): def _test_dummy():
......
...@@ -8,7 +8,7 @@ if cuda_ndarray.enable_cuda == False: ...@@ -8,7 +8,7 @@ if cuda_ndarray.enable_cuda == False:
import numpy import numpy
def test_host_to_device(): def test_host_to_device():
print >>sys.stderr, 'starting test_host_to_dev' print >>sys.stdout, 'starting test_host_to_dev'
for shape in ((), (3,), (2,3), (3,4,5,6)): for shape in ((), (3,), (2,3), (3,4,5,6)):
a = theano._asarray(numpy.random.rand(*shape), dtype='float32') a = theano._asarray(numpy.random.rand(*shape), dtype='float32')
b = cuda_ndarray.CudaNdarray(a) b = cuda_ndarray.CudaNdarray(a)
...@@ -53,7 +53,7 @@ def test_add(): ...@@ -53,7 +53,7 @@ def test_add():
def test_exp(): def test_exp():
print >>sys.stderr, 'starting test_exp' print >>sys.stdout, 'starting test_exp'
for shape in ((), (3,), (2,3), (1,10000000),(10,1000000), (100,100000),(1000,10000),(10000,1000)): for shape in ((), (3,), (2,3), (1,10000000),(10,1000000), (100,100000),(1000,10000),(10000,1000)):
a0 = theano._asarray(numpy.random.rand(*shape), dtype='float32') a0 = theano._asarray(numpy.random.rand(*shape), dtype='float32')
a1 = a0.copy() a1 = a0.copy()
...@@ -74,25 +74,25 @@ def test_exp(): ...@@ -74,25 +74,25 @@ def test_exp():
def test_copy(): def test_copy():
print >>sys.stderr, 'starting test_copy' print >>sys.stdout, 'starting test_copy'
shape = (5,) shape = (5,)
a = theano._asarray(numpy.random.rand(*shape), dtype='float32') a = theano._asarray(numpy.random.rand(*shape), dtype='float32')
print >>sys.stderr, '.. creating device object' print >>sys.stdout, '.. creating device object'
b = cuda_ndarray.CudaNdarray(a) b = cuda_ndarray.CudaNdarray(a)
print >>sys.stderr, '.. copy' print >>sys.stdout, '.. copy'
c = copy.copy(b) c = copy.copy(b)
print >>sys.stderr, '.. deepcopy' print >>sys.stdout, '.. deepcopy'
d = copy.deepcopy(b) d = copy.deepcopy(b)
print >>sys.stderr, '.. comparisons' print >>sys.stdout, '.. comparisons'
assert numpy.allclose(a, numpy.asarray(b)) assert numpy.allclose(a, numpy.asarray(b))
assert numpy.allclose(a, numpy.asarray(c)) assert numpy.allclose(a, numpy.asarray(c))
assert numpy.allclose(a, numpy.asarray(d)) assert numpy.allclose(a, numpy.asarray(d))
def test_dot(): def test_dot():
print >>sys.stderr, 'starting test_dot' print >>sys.stdout, 'starting test_dot'
a0 = theano._asarray(numpy.random.rand(4, 7), dtype='float32') a0 = theano._asarray(numpy.random.rand(4, 7), dtype='float32')
a1 = theano._asarray(numpy.random.rand(7, 6), dtype='float32') a1 = theano._asarray(numpy.random.rand(7, 6), dtype='float32')
...@@ -101,7 +101,7 @@ def test_dot(): ...@@ -101,7 +101,7 @@ def test_dot():
assert numpy.allclose(numpy.dot(a0, a1), cuda_ndarray.dot(b0, b1)) assert numpy.allclose(numpy.dot(a0, a1), cuda_ndarray.dot(b0, b1))
print >> sys.stderr, 'WARNING test_dot: not testing all 8 transpose cases of dot' print >> sys.stderr, 'WARNING TODO test_dot: not testing all 8 transpose cases of dot'
def test_sum(): def test_sum():
shape = (2,3) shape = (2,3)
...@@ -147,7 +147,7 @@ def test_reshape(): ...@@ -147,7 +147,7 @@ def test_reshape():
] ]
def subtest(shape_1, shape_2): def subtest(shape_1, shape_2):
#print >> sys.stderr, "INFO: shapes", shape_1, shape_2 #print >> sys.stdout, "INFO: shapes", shape_1, shape_2
a = theano._asarray(numpy.random.rand(*shape_1), dtype='float32') a = theano._asarray(numpy.random.rand(*shape_1), dtype='float32')
b = cuda_ndarray.CudaNdarray(a) b = cuda_ndarray.CudaNdarray(a)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论