提交 c59f1c47 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

make sure test returns ndarray

上级 cfcad7a4
...@@ -14,9 +14,10 @@ def test_viewop_gpu(): ...@@ -14,9 +14,10 @@ def test_viewop_gpu():
raise SkipTest('Optional package cuda disabled') raise SkipTest('Optional package cuda disabled')
_x = theano.tensor.fvector('x') _x = theano.tensor.fvector('x')
x = cuda.gpu_from_host(_x) x = cuda.gpu_from_host(_x)
out = theano.compile.function_module.ViewOp()(x) _out = theano.compile.function_module.ViewOp()(x)
out = cuda.host_from_gpu(_out)
f = theano.function([x], f = theano.function([x],
[theano.compile.function_module.ViewOp()(x)], out,
mode=mode_with_gpu) mode=mode_with_gpu)
data = numpy.array([1, 2, 3], dtype='float32') data = numpy.array([1, 2, 3], dtype='float32')
assert numpy.allclose(f(data), data) assert numpy.allclose(f(data), data)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论