提交 b320ab29 authored 作者: abergeron's avatar abergeron

Merge pull request #2380 from nouiz/tests

Fix tests
......@@ -397,7 +397,9 @@ def build_conv_nnet2_classif(use_gpu, isize, ksize, n_batch,
# Check that GpuConv is used
topo = train.maker.fgraph.toposort()
conv_ops = (tcn.blas.GpuConv,
tcn.dnn.GpuDnnConvBase,
tcn.dnn.GpuDnnConv,
tcn.dnn.GpuDnnConvGradI,
tcn.dnn.GpuDnnConvGradW,
tcn.blas.BaseGpuCorrMM)
assert len([n for n in topo if isinstance(n.op, conv_ops)]) > 0
......
......@@ -1007,7 +1007,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
return (3, self.GpuKernelBase_version)
def guess_n_streams(size, warn=True):
def guess_n_streams(size, warn=False):
"""
Return a guess at a good number of streams.
......@@ -1128,7 +1128,7 @@ class MRG_RandomStreams(object):
return rval
def n_streams(self, size):
return guess_n_streams(size, warn=True)
return guess_n_streams(size)
def pretty_return(self, node_rstate, new_rstate, sample):
sample.rstate = node_rstate
......
......@@ -251,10 +251,11 @@ def test_expm_grad_1():
if not imported_scipy:
raise SkipTest("Scipy needed for the expm op.")
rng = numpy.random.RandomState(utt.fetch_seed())
A = rng.randn(5, 5).astype(config.floatX)
# Always test in float64 for better numerical stability.
A = rng.randn(5, 5)
A = A + A.T
tensor.verify_grad(expm, [A,], rng=rng)
tensor.verify_grad(expm, [A], rng=rng)
def test_expm_grad_2():
......@@ -262,12 +263,13 @@ def test_expm_grad_2():
if not imported_scipy:
raise SkipTest("Scipy needed for the expm op.")
rng = numpy.random.RandomState(utt.fetch_seed())
A = rng.randn(5, 5).astype(config.floatX)
w = (rng.randn(5).astype(config.floatX))**2
# Always test in float64 for better numerical stability.
A = rng.randn(5, 5)
w = rng.randn(5)**2
A = (numpy.diag(w**0.5)).dot(A + A.T).dot(numpy.diag(w**(-0.5)))
assert not numpy.allclose(A, A.T)
tensor.verify_grad(expm, [A,], rng=rng)
tensor.verify_grad(expm, [A], rng=rng)
def test_expm_grad_3():
......@@ -275,6 +277,7 @@ def test_expm_grad_3():
if not imported_scipy:
raise SkipTest("Scipy needed for the expm op.")
rng = numpy.random.RandomState(utt.fetch_seed())
A = rng.randn(5, 5).astype(config.floatX)
# Always test in float64 for better numerical stability.
A = rng.randn(5, 5)
tensor.verify_grad(expm, [A,], rng=rng)
tensor.verify_grad(expm, [A], rng=rng)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论