提交 ff8647e4 authored 作者: Firstname Lastname's avatar Firstname Lastname

doc update about ifelse op in cifar SC

上级 fe07d9b4
......@@ -211,14 +211,13 @@ Conditions
----------
**IfElse**
- build condition over symbolic variables
- IfElse Op takes a boolean condition and two variables to compute as input
- while switch evaluate both 'output' variables, IfElse is lazy and only
evaluate one variable respect to the condition
- Build condition over symbolic variables.
- IfElse Op takes a boolean condition and two variables to compute as input.
- While Switch Op evaluates both 'output' variables, IfElse Op is lazy and only
evaluates one variable respect to the condition.
**IfElse Example: Comparison with Switch**
.. code-block:: python
from theano import tensor as T
......@@ -256,13 +255,17 @@ Conditions
IfElse Op spend less time (about an half) than Switch since it computes only
one variable instead of both.
>>> python ifelse_switch.py
time spent evaluating both values 0.6700 sec
time spent evaluating one value 0.3500 sec
Note that IfElse condition is a boolean while Switch condition is a tensor, so
the comparison might be unfair.
Switch is more general.
It is actually important to use ``linker='vm'`` or ``linker='cvm'``,
otherwise IfElse will compute both variables and take the same computation
time as the Switch Op. The linker is not currently set by default to 'cvm' but
it will in a near future.
Loops
-----
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论