提交 fa268e58 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

adding some more info about the logical flow in the implementation of scan

上级 fa469ebd
...@@ -134,6 +134,19 @@ files, and section of the code they deal with, are : ...@@ -134,6 +134,19 @@ files, and section of the code they deal with, are :
* ``scan_opt.py`` contains the list of all optimizations for the scan * ``scan_opt.py`` contains the list of all optimizations for the scan
operator. operator.
* ``cscan.pyx`` contains a cython implementation for the scan operator. The logical flow
----------------
First the scan arguments are parsed by the function ``canonical_arguments``,
that wraps them into lists and adds default values for the arguments. One
important step that happens in this function is that the inputs arguments
are converted such that they all have a single tap, namely 0. For example
if you have ``[{'input':u, 'taps':[0, 4]}]`` as the list of inputs arguments
to scan, it gets converted into ``[{'input':u, 'taps':[0]}, {'input':u[4:],
'taps':[0]}]``.
The second step is to check if ``n_steps`` is a constant and has the value 1
or -1. If that is true then the function ``one_step_scan`` is called which
unwraps the computation of the inner function into the outer graph without
adding any scan op in the graph.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论