提交 b351f47a authored 作者: carriepl's avatar carriepl

Add test for function using In wrapped

上级 08ffec41
...@@ -6,6 +6,7 @@ import tempfile ...@@ -6,6 +6,7 @@ import tempfile
import numpy import numpy
import theano import theano
from theano.compile.io import In
def test_function_dump(): def test_function_dump():
...@@ -26,3 +27,11 @@ def test_function_dump(): ...@@ -26,3 +27,11 @@ def test_function_dump():
fct2 = theano.function(**l) fct2 = theano.function(**l)
x = [1, 2, 3] x = [1, 2, 3]
assert numpy.allclose(fct1(x), fct2(x)) assert numpy.allclose(fct1(x), fct2(x))
def test_function_in():
# Test that using In wrappers for the inputs of a function works as
# expected
v = theano.tensor.ivector()
f = theano.function([In(v, mutable=True)], v + 1)
assert numpy.allclose(f([1, 2, 3]), [2, 3, 4])
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论