提交 762cb0d1 authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Arnaud Bergeron

testcode for doc/tutorial/conditions.txt

上级 af235f4e
...@@ -18,7 +18,7 @@ IfElse vs Switch ...@@ -18,7 +18,7 @@ IfElse vs Switch
**Example** **Example**
.. code-block:: python .. testcode::
from theano import tensor as T from theano import tensor as T
from theano.ifelse import ifelse from theano.ifelse import ifelse
...@@ -55,13 +55,19 @@ IfElse vs Switch ...@@ -55,13 +55,19 @@ IfElse vs Switch
In this example, the ``IfElse`` op spends less time (about half as much) than ``Switch`` In this example, the ``IfElse`` op spends less time (about half as much) than ``Switch``
since it computes only one variable out of the two. since it computes only one variable out of the two.
.. code-block:: python .. testoutput::
:hide:
:options: +ELLIPSIS
>>> python ifelse_switch.py time spent evaluating both values ... sec
time spent evaluating one value ... sec
.. code-block:: none
$ python ifelse_switch.py
time spent evaluating both values 0.6700 sec time spent evaluating both values 0.6700 sec
time spent evaluating one value 0.3500 sec time spent evaluating one value 0.3500 sec
Unless ``linker='vm'`` or ``linker='cvm'`` are used, ``ifelse`` will compute both Unless ``linker='vm'`` or ``linker='cvm'`` are used, ``ifelse`` will compute both
variables and take the same computation time as ``switch``. Although the linker variables and take the same computation time as ``switch``. Although the linker
is not currently set by default to ``cvm``, it will be in the near future. is not currently set by default to ``cvm``, it will be in the near future.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论