提交 8f21de0b authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #2090 from nouiz/buildbot

Buildbot
...@@ -28,7 +28,7 @@ def test_profiling(): ...@@ -28,7 +28,7 @@ def test_profiling():
p = theano.ProfileStats(False) p = theano.ProfileStats(False)
if theano.config.mode in ["DebugMode", "DEBUG_MODE"]: if theano.config.mode in ["DebugMode", "DEBUG_MODE", "FAST_COMPILE"]:
m = "FAST_RUN" m = "FAST_RUN"
else: else:
m = None m = None
......
...@@ -132,17 +132,21 @@ class TestOp: ...@@ -132,17 +132,21 @@ class TestOp:
def test_op_struct(self): def test_op_struct(self):
sop = StructOp() sop = StructOp()
c = sop(theano.tensor.constant(0)) c = sop(theano.tensor.constant(0))
f = theano.function([], c) mode = None
if theano.config.mode == 'FAST_COMPILE':
mode = 'FAST_RUN'
f = theano.function([], c, mode=mode)
rval = f() rval = f()
assert rval == 0 assert rval == 0
rval = f() rval = f()
assert rval == 1 assert rval == 1
c2 = sop(theano.tensor.constant(1)) c2 = sop(theano.tensor.constant(1))
f2 = theano.function([], [c, c2]) f2 = theano.function([], [c, c2], mode=mode)
rval = f2() rval = f2()
assert rval == [0, 0] assert rval == [0, 0]
class TestMakeThunk(unittest.TestCase): class TestMakeThunk(unittest.TestCase):
def test_no_c_code(self): def test_no_c_code(self):
class IncOnePython(Op): class IncOnePython(Op):
......
...@@ -3345,6 +3345,13 @@ class GpuContiguous(GpuOp): ...@@ -3345,6 +3345,13 @@ class GpuContiguous(GpuOp):
input = as_cuda_ndarray_variable(input) input = as_cuda_ndarray_variable(input)
return Apply(self, [input], [input.type()]) return Apply(self, [input], [input.type()])
def perform(self, node, inp, out):
i = inp[0]
if not i.is_c_contiguous():
i = i.copy()
assert i.is_c_contiguous()
out[0][0] = i
def c_code(self, node, name, inp, out, sub): def c_code(self, node, name, inp, out, sub):
input, = inp input, = inp
z, = out z, = out
......
...@@ -641,7 +641,8 @@ def test_valid(conv_gemm=False): ...@@ -641,7 +641,8 @@ def test_valid(conv_gemm=False):
shapes += get_shapes2(scales_img=(2, 2), img_stride=(2, 2)) shapes += get_shapes2(scales_img=(2, 2), img_stride=(2, 2))
shapes += get_shapes2(scales_kern=(2, 2), kern_stride=(2, 2)) shapes += get_shapes2(scales_kern=(2, 2), kern_stride=(2, 2))
else: else:
mode = cls = None mode = theano_mode
cls = None
exec_conv(version, shapes, verbose, random, 'valid', exec_conv(version, shapes, verbose, random, 'valid',
print_=print_, ones=ones, rtol=1.1e-5, print_=print_, ones=ones, rtol=1.1e-5,
theano_mode=mode, cls=cls) theano_mode=mode, cls=cls)
...@@ -717,7 +718,8 @@ def test_full(conv_gemm=False): ...@@ -717,7 +718,8 @@ def test_full(conv_gemm=False):
# dummy version; not used by GpuCorrMM so one version is enough # dummy version; not used by GpuCorrMM so one version is enough
version = [-1] version = [-1]
else: else:
mode = cls = None mode = theano_mode
cls = None
exec_conv(version, shapes, verbose, random, 'full', exec_conv(version, shapes, verbose, random, 'full',
theano_mode=mode, cls=cls) theano_mode=mode, cls=cls)
...@@ -757,7 +759,8 @@ def test_subsample(conv_gemm=False): ...@@ -757,7 +759,8 @@ def test_subsample(conv_gemm=False):
# dummy version; not used by GpuCorrMM so one version is enough # dummy version; not used by GpuCorrMM so one version is enough
version_valid = version_full = [-1] version_valid = version_full = [-1]
else: else:
mode = cls = None mode = theano_mode
cls = None
exec_conv(version_valid, shapes, verbose, random, 'valid', exec_conv(version_valid, shapes, verbose, random, 'valid',
print_=print_, ones=ones, print_=print_, ones=ones,
......
...@@ -2887,10 +2887,13 @@ class T_Tile(unittest.TestCase): ...@@ -2887,10 +2887,13 @@ class T_Tile(unittest.TestCase):
def test_local_useless_tile(self): def test_local_useless_tile(self):
v = T.vector() v = T.vector()
m = T.matrix() m = T.matrix()
mode = None
if theano.config.mode == "FAST_COMPILE":
mode = "FAST_RUN"
for var, data in [(v, [1, 2, 3]), (m, [[1, 2], [3, 4]])]: for var, data in [(v, [1, 2, 3]), (m, [[1, 2], [3, 4]])]:
# Currently, only a repeat patter == ndim is supported. # Currently, only a repeat patter == ndim is supported.
for ndim in [var.ndim]: # range(1, var.ndim): for ndim in [var.ndim]: # range(1, var.ndim):
f = theano.function([var], T.tile(var, (1,)*ndim)) f = theano.function([var], T.tile(var, (1,)*ndim), mode=mode)
topo = f.maker.fgraph.toposort() topo = f.maker.fgraph.toposort()
assert len(topo) == 1 assert len(topo) == 1
assert isinstance(topo[0].op, compile.DeepCopyOp) assert isinstance(topo[0].op, compile.DeepCopyOp)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论