提交 9d5789bd authored 作者: notoraptor's avatar notoraptor

Replace test_local_gpu_elemwise_careduce with test_dnn_reduction_sum_squares in test_opt.

上级 8655069d
...@@ -1569,19 +1569,6 @@ def test_dnn_reduction_opt(): ...@@ -1569,19 +1569,6 @@ def test_dnn_reduction_opt():
yield dnn_reduction, 2, idtype, adtype, odtype yield dnn_reduction, 2, idtype, adtype, odtype
def test_dnn_reduction_sum_squares():
if not dnn.dnn_available(test_ctx_name) or dnn.version(raises=False) < 6000:
raise SkipTest(dnn.dnn_available.msg)
M = T.matrix()
out = (M**2).sum()
f = theano.function([M], out, mode=mode_with_gpu)
assert any(isinstance(node.op, dnn.GpuDnnReduction) and node.op.red_op == 'norm2'
for node in f.maker.fgraph.apply_nodes)
M_val = np.random.random((4, 5)).astype(theano.config.floatX)
utt.assert_allclose((M_val**2).sum(), f(M_val))
def dnn_reduction_strides(shp, shuffle, slice): def dnn_reduction_strides(shp, shuffle, slice):
utt.fetch_seed() utt.fetch_seed()
inp = GpuArrayType('float32', (False,) * len(shp), inp = GpuArrayType('float32', (False,) * len(shp),
......
...@@ -359,24 +359,19 @@ def test_pdbbreakpoint_op(): ...@@ -359,24 +359,19 @@ def test_pdbbreakpoint_op():
assert _check_stack_trace(f) assert _check_stack_trace(f)
def test_local_gpu_elemwise_careduce(): def test_dnn_reduction_sum_squares():
x = theano.tensor.matrix() if not dnn.dnn_available(test_ctx_name) or dnn.version(raises=False) < 6000:
o = (x * x).sum() raise SkipTest(dnn.dnn_available.msg)
f = theano.function([x], o, mode=mode_with_gpu)
topo = f.maker.fgraph.toposort() M = tensor.matrix()
assert len(topo) == 3 for axis in (None, 0, 1):
assert topo[1].op.pre_scalar_op == theano.scalar.sqr out = (M**2).sum(axis=axis)
assert _check_stack_trace(f) f = theano.function([M], out, mode=mode_with_gpu)
data = np.random.rand(3, 4).astype(theano.config.floatX) assert any(isinstance(node.op, dnn.GpuDnnReduction) and node.op.red_op == 'norm2'
utt.assert_allclose(f(data), (data * data).sum()) for node in f.maker.fgraph.apply_nodes)
o = (x * x).sum(axis=1)
f = theano.function([x], o, mode=mode_with_gpu)
topo = f.maker.fgraph.toposort()
assert len(topo) == 3
assert topo[1].op.pre_scalar_op == theano.scalar.sqr
assert _check_stack_trace(f) assert _check_stack_trace(f)
utt.assert_allclose(f(data), (data * data).sum(axis=1)) M_val = np.random.random((4, 5)).astype(theano.config.floatX)
utt.assert_allclose((M_val**2).sum(axis=axis), f(M_val))
def test_local_lift_dot22scalar(): def test_local_lift_dot22scalar():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论