提交 9a2dffdd authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Actually check the output when testing for uncommon strides.

上级 bb4dc983
...@@ -1512,6 +1512,7 @@ def test_dnn_reduction_opt(): ...@@ -1512,6 +1512,7 @@ def test_dnn_reduction_opt():
def dnn_reduction_strides(shp, shuffle, slice): def dnn_reduction_strides(shp, shuffle, slice):
utt.fetch_seed()
inp = GpuArrayType('float32', (False,) * len(shp), inp = GpuArrayType('float32', (False,) * len(shp),
context_name=test_ctx_name)() context_name=test_ctx_name)()
tmp = inp.dimshuffle(shuffle)[slice] tmp = inp.dimshuffle(shuffle)[slice]
...@@ -1519,7 +1520,11 @@ def dnn_reduction_strides(shp, shuffle, slice): ...@@ -1519,7 +1520,11 @@ def dnn_reduction_strides(shp, shuffle, slice):
f = theano.function([inp], res, mode=mode_with_gpu) f = theano.function([inp], res, mode=mode_with_gpu)
assert any(isinstance(n.op, dnn.GpuDnnReduction) assert any(isinstance(n.op, dnn.GpuDnnReduction)
for n in f.maker.fgraph.apply_nodes) for n in f.maker.fgraph.apply_nodes)
f(pygpu.zeros(shp, dtype='float32', context=inp.type.context)) data = np.random.random(shp).astype('float32')
res = np.sum(data)
gdata = pygpu.array(data, context=inp.type.context)
gres = f(gdata)
utt.assert_allclose(res, np.array(gres))
def test_dnn_reduction_strides(): def test_dnn_reduction_strides():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论