提交 0f79103e authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Arnaud Bergeron

testcode for doc/library/compile/io.txt

上级 2ddadd2f
...@@ -80,6 +80,9 @@ A non-None `value` argument makes an In() instance an optional parameter ...@@ -80,6 +80,9 @@ A non-None `value` argument makes an In() instance an optional parameter
of the compiled function. For example, in the following code we are of the compiled function. For example, in the following code we are
defining an arity-2 function ``inc``. defining an arity-2 function ``inc``.
>>> import theano.tensor as T
>>> from theano import function
>>> from theano.compile.io import In
>>> u, x, s = T.scalars('u', 'x', 's') >>> u, x, s = T.scalars('u', 'x', 's')
>>> inc = function([u, In(x, value=3), In(s, update=(s+x*u), value=10.0)], []) >>> inc = function([u, In(x, value=3), In(s, update=(s+x*u), value=10.0)], [])
...@@ -179,7 +182,7 @@ method to access values by indexing a Function directly by typing ...@@ -179,7 +182,7 @@ method to access values by indexing a Function directly by typing
To show some examples of these access methods... To show some examples of these access methods...
.. code-block:: python .. testcode::
a, b, c = T.scalars('xys') # set the internal names of graph nodes a, b, c = T.scalars('xys') # set the internal names of graph nodes
# Note that the name of c is 's', not 'c'! # Note that the name of c is 's', not 'c'!
...@@ -221,7 +224,7 @@ Every element of the inputs list will be upgraded to an In instance if necessary ...@@ -221,7 +224,7 @@ Every element of the inputs list will be upgraded to an In instance if necessary
Example: Example:
.. code-block:: python .. testcode::
import theano import theano
from theano import tensor as T from theano import tensor as T
...@@ -282,7 +285,7 @@ If a single ``Variable`` or ``Out`` instance is given as argument, then the comp ...@@ -282,7 +285,7 @@ If a single ``Variable`` or ``Out`` instance is given as argument, then the comp
If a list of ``Variable`` or ``Out`` instances is given as argument, then the compiled function will return a list of their values. If a list of ``Variable`` or ``Out`` instances is given as argument, then the compiled function will return a list of their values.
.. code-block:: python .. testcode::
x, y, s = T.matrices('xys') x, y, s = T.matrices('xys')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论