There seems to be some confusion about what the "for loop" means. There
are two ways a for loop can be used:
- Compile a Theano function that does one step of the loop, and call
this function repeatedly in a for loop. I think that is what Olivier's
replies are about.
- Use a for loop in Python while building the function graph. This will
indeed unroll the loop (the loop will be executed once, creating new
nodes at each iteration). The main drawback of this method is that the
size of the graph can become quite big, leading to two main problems:
possible busting of the Python stack (which can be avoided to some
extent by raising the stack limit), and increased graph compilation time
(it scales super-linearly wrt the number of nodes in the graph. Another
drawback is that you cannot have the number of loops to execute be a
symbolic variable: it has to be known when you build the graph (this can
be somewhat mitigated by building a large loop and use the ifelse lazy
conditional to skip the remaining iterations).
Hope this helps,
> >>> Le 2013-10-13 � 17:53, Mateusz Malinowski <
m4l...@gmail.com> a �crit :
> >>>
> >>> Hi,
> >>> Is there any performance penalty (apart from larger computational graph)
> >>> when using for loop instead of scan loop?
> >>> What are benefits of using the latter over the former if we want to loop
> >>> only over a small set of elements?
> >>>
> >>> Best,
> >>> M.M.
> >>>
> >>> --
> >>>
> >>> ---
> >>> You received this message because you are subscribed to the Google
> >>> Groups "theano-dev" group.
> >>> To unsubscribe from this group and stop receiving emails from it, send
> >>> an email to theano-dev+...@**
googlegroups.com.
> >>>
> >>> For more options, visit
https://groups.google.com/**groups/opt_out<
https://groups.google.com/groups/opt_out>
> >>> .
> >>>
> >>>
> >
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "theano-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
theano-users...@googlegroups.com.
--
Pascal