提交 0bc7d0df authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Test the lifted function for Dot22Scalar.

上级 dfe4049d
...@@ -261,11 +261,16 @@ def test_local_lift_dot22scalar(): ...@@ -261,11 +261,16 @@ def test_local_lift_dot22scalar():
y = tensor.matrix() y = tensor.matrix()
a = tensor.scalar() a = tensor.scalar()
o = tensor.blas.Dot22Scalar()(x, y, a) o = tensor.blas.Dot22Scalar()(x, y, a)
f = theano.function([x, y, a], o, mode=mode_with_gpu) f_cpu = theano.function([x, y, a], o)
f_gpu = theano.function([x, y, a], o, mode=mode_with_gpu)
assert not any(isinstance(n.op, tensor.blas.Dot22Scalar) assert not any(isinstance(n.op, tensor.blas.Dot22Scalar)
for n in f.maker.fgraph.apply_nodes) for n in f_gpu.maker.fgraph.apply_nodes)
assert any(isinstance(n.op, GpuGemm) assert any(isinstance(n.op, GpuGemm)
for n in f.maker.fgraph.apply_nodes) for n in f_gpu.maker.fgraph.apply_nodes)
x_val = numpy.random.random((2, 3)).astype(theano.config.floatX)
y_val = numpy.random.random((3, 4)).astype(theano.config.floatX)
a_val = 0.5
utt.assert_allclose(f_cpu(x_val, y_val, a_val), f_gpu(x_val, y_val, a_val))
def test_local_gpu_subtensor(): def test_local_gpu_subtensor():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论