提交 9f22e99a authored 作者: Frederic Bastien's avatar Frederic Bastien

test_bench_loopfusion.py in debug mode use smaller dimensions to have it work in a reasonable time.

上级 9a1e8ce4
...@@ -263,15 +263,21 @@ def test_bench_elemwise(n_iter=1000, **kwargs): ...@@ -263,15 +263,21 @@ def test_bench_elemwise(n_iter=1000, **kwargs):
import theano_cuda_ndarray import theano_cuda_ndarray
theano_cuda_ndarray.use() theano_cuda_ndarray.use()
debug=False
if theano.compile.default_mode=="DEBUG_MODE": debug=True
# get symbolic train set # get symbolic train set
s_lr = theano.tensor.fscalar() s_lr = theano.tensor.fscalar()
x = theano.tensor.TensorType(dtype=conf.dtype, broadcastable=(0,0), shape=(None, 784))() x = theano.tensor.TensorType(dtype=conf.dtype, broadcastable=(0,0), shape=(None, 784 if not debug else 3))()
y = theano.tensor.lvector() y = theano.tensor.lvector()
rng = numpy.random.RandomState(conf.rng_seed) rng = numpy.random.RandomState(conf.rng_seed)
if not debug:
layer = Kouh2008.new_filters_expbounds(rng, x, x.type.shape[1], conf.n_hid, conf.n_terms) layer = Kouh2008.new_filters_expbounds(rng, x, x.type.shape[1], conf.n_hid, conf.n_terms)
else:
layer = Kouh2008.new_filters_expbounds(rng, x, x.type.shape[1], 3, 2)
n_iter=3
cost = layer.output.mean() cost = layer.output.mean()
assert cost.type.ndim == 0 assert cost.type.ndim == 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论