提交 eab9cf5d authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #4092 from abergeron/fix_buildbot2

New problems cropped up on the buildbot
...@@ -3684,7 +3684,7 @@ class GpuAllocEmpty(GpuOp): ...@@ -3684,7 +3684,7 @@ class GpuAllocEmpty(GpuOp):
return Apply(self, shape, [output]) return Apply(self, shape, [output])
def debug_perform(self, node, inputs, out_): def debug_perform(self, node, inputs, out_):
self.perform(self, node, inputs, out_) self.perform(node, inputs, out_)
# __setitem__ is limited on CudaNdarray # __setitem__ is limited on CudaNdarray
tmp = numpy.empty(out_[0][0].shape, dtype='float32') tmp = numpy.empty(out_[0][0].shape, dtype='float32')
tmp.fill(-123456789) tmp.fill(-123456789)
...@@ -3769,6 +3769,10 @@ class GpuAlloc(GpuAllocEmpty): ...@@ -3769,6 +3769,10 @@ class GpuAlloc(GpuAllocEmpty):
shape, output = self.validate_shape(shape) shape, output = self.validate_shape(shape)
return Apply(self, [v] + shape, [output]) return Apply(self, [v] + shape, [output])
# This is required because the superclass (GpuAllocEmpty) also has it.
def debug_perform(self, node, inputs, out_):
self.perform(node, inputs, out_)
def perform(self, node, inputs, out_): def perform(self, node, inputs, out_):
# the super class (GpuAllocEmpty) allocates memory, we fill it # the super class (GpuAllocEmpty) allocates memory, we fill it
value = inputs[0] value = inputs[0]
......
...@@ -17,7 +17,7 @@ if cuda_ndarray.cuda_available == False: ...@@ -17,7 +17,7 @@ if cuda_ndarray.cuda_available == False:
import theano.sandbox.cuda as tcn import theano.sandbox.cuda as tcn
from theano.tensor.signal.pool import (Pool, from theano.tensor.signal.pool import (Pool,
DownsampleFactorMaxGrad, DownsampleFactorMaxGradGrad) PoolGrad, DownsampleFactorMaxGradGrad)
import theano.compile.mode import theano.compile.mode
from theano.tensor.tests.test_blas import BaseGemv, TestBlasStrides, TestGer from theano.tensor.tests.test_blas import BaseGemv, TestBlasStrides, TestGer
...@@ -394,7 +394,7 @@ def test_downsample(): ...@@ -394,7 +394,7 @@ def test_downsample():
assert any([isinstance(node.op, assert any([isinstance(node.op,
tcn.blas.GpuDownsampleFactorMaxGrad) tcn.blas.GpuDownsampleFactorMaxGrad)
for node in g.maker.fgraph.toposort()]) for node in g.maker.fgraph.toposort()])
assert any([isinstance(node.op, DownsampleFactorMaxGrad) assert any([isinstance(node.op, PoolGrad)
for node in g2.maker.fgraph.toposort()]) for node in g2.maker.fgraph.toposort()])
assert numpy.allclose(g(), g2()), shp assert numpy.allclose(g(), g2()), shp
......
...@@ -926,7 +926,7 @@ class PushOutScanOutput(gof.Optimizer): ...@@ -926,7 +926,7 @@ class PushOutScanOutput(gof.Optimizer):
# For the inner_vars that don't already exist in the outer graph, add # For the inner_vars that don't already exist in the outer graph, add
# them as new nitsot outputs to the scan node. # them as new nitsot outputs to the scan node.
idx_add_as_nitsots = [i for i in range(len(outer_vars)) idx_add_as_nitsots = [i for i in range(len(outer_vars))
if outer_vars[i] == None] if outer_vars[i] is None]
add_as_nitsots = [inner_vars[idx] for idx in idx_add_as_nitsots] add_as_nitsots = [inner_vars[idx] for idx in idx_add_as_nitsots]
if len(add_as_nitsots) > 0: if len(add_as_nitsots) > 0:
......
...@@ -67,6 +67,15 @@ def eval_outputs(outputs): ...@@ -67,6 +67,15 @@ def eval_outputs(outputs):
return compile.function([], outputs)()[0] return compile.function([], outputs)()[0]
# scipy 0.17 will return sparse values in all cases while previous
# version sometimes wouldn't. This will make everything dense so that
# we can use assert_allclose.
def as_ndarray(val):
if hasattr(val, 'toarray'):
return val.toarray()
return val
def random_lil(shape, dtype, nnz): def random_lil(shape, dtype, nnz):
rval = sp.lil_matrix(shape, dtype=dtype) rval = sp.lil_matrix(shape, dtype=dtype)
huge = 2 ** 30 huge = 2 ** 30
...@@ -2956,7 +2965,7 @@ class StructuredAddSVTester(unittest.TestCase): ...@@ -2956,7 +2965,7 @@ class StructuredAddSVTester(unittest.TestCase):
out = f(spmat, mat) out = f(spmat, mat)
utt.assert_allclose(spones.multiply(spmat + mat), utt.assert_allclose(as_ndarray(spones.multiply(spmat + mat)),
out.toarray()) out.toarray())
...@@ -3072,7 +3081,7 @@ class SamplingDotTester(utt.InferShapeTester): ...@@ -3072,7 +3081,7 @@ class SamplingDotTester(utt.InferShapeTester):
x, y, p = self.a x, y, p = self.a
expected = p.multiply(numpy.dot(x, y.T)) expected = p.multiply(numpy.dot(x, y.T))
utt.assert_allclose(expected, tested.toarray()) utt.assert_allclose(as_ndarray(expected), tested.toarray())
assert tested.format == 'csr' assert tested.format == 'csr'
assert tested.dtype == expected.dtype assert tested.dtype == expected.dtype
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论