Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f2d65b5f
提交
f2d65b5f
authored
11月 23, 2010
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed a few typos in scan doc
上级
bf02577b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
21 行增加
和
21 行删除
+21
-21
scan.py
theano/scan.py
+21
-21
没有找到文件。
theano/scan.py
浏览文件 @
f2d65b5f
...
...
@@ -332,7 +332,7 @@ def scan( fn
The list of ``non_sequences`` can also contain shared variables
used in the function, though ``scan`` is able to figure those
out on its own so they can be skipped. For the clarity of the
code we recomm
a
nd though to provide them to scan.
code we recomm
e
nd though to provide them to scan.
The function is expected to return two things. One is a list of
outputs ordered in the same order as ``outputs_info``, with the
...
...
@@ -358,12 +358,12 @@ def scan( fn
sequence.
* ``taps`` -- Temporal taps of the sequence required by ``fn``.
They are provided as a list of integers, where a value ``k`` imp
il
es
They are provided as a list of integers, where a value ``k`` imp
li
es
that at iteration step ``t`` scan will pass to ``fn`` the slice
``t+k``. Default value is ``[0]``
Any Theano variable in the list ``sequences`` is automatically
wrapped into a dictionary where ``taps`` is set to ``[0]``
wrapped into a dictionary where ``taps`` is set to ``[0]``
.
:param outputs_info:
...
...
@@ -376,8 +376,8 @@ def scan( fn
* ``initial`` -- Theano variable that represents the initial
state of a given output. In case the output is not computed
recursively (think of a map) and does not require a initial
state this field can be skiped. Given that only the previous
recursively (think of a map) and does not require a
n
initial
state this field can be skip
p
ed. Given that only the previous
time step of the output is used by ``fn`` the initial state
should have the same shape as the output. If multiple time
taps are used, the initial state should have one extra
...
...
@@ -388,16 +388,16 @@ def scan( fn
the initial state, which in this case should have the shape
(5,)+output.shape. If this variable containing the initial
state is called ``init_y`` then ``init_y[0]`` *corresponds to*
``output[-5]``
. ``init_y[1]`` *correponds to* ``output[-4]``,
``init_y[2]`` corresponds to ``output[-3]``
,
``init_y[3]``
coresponds to ``output[-2]``
,
``init_y[4]`` corresponds to
``output[-5]``
; ``init_y[1]`` *correponds to* ``output[-4]``;
``init_y[2]`` corresponds to ``output[-3]``
;
``init_y[3]``
coresponds to ``output[-2]``
;
``init_y[4]`` corresponds to
``output[-1]``. While this order might seem strange, it comes
natural from splitting an array at a given point. Assume that
we have a array ``x``, and we choose ``k`` to be time step
``0``. Then our initial state would be ``x[:k]``, while the
output will be ``x[k:]``. Looking at this split, elements in
``x[:k]`` are ordered exactly like those in ``init_y``.
* ``taps`` -- Temporal taps of the output that will be pass to
* ``taps`` -- Temporal taps of the output that will be pass
ed
to
``fn``. They are provided as a list of *negative* integers,
where a value ``k`` implies that at iteration step ``t`` scan will
pass to ``fn`` the slice ``t+k``.
...
...
@@ -417,12 +417,12 @@ def scan( fn
provided, ``scan`` will return ``output[-k:]``. This is meant as a
hint, based on ``k`` and the past taps of the outputs used, scan
can be smart about the amount of memory it requires to store
interm
i
diate results. If not given, or ``0``, ``scan`` will return
interm
e
diate results. If not given, or ``0``, ``scan`` will return
all computed steps.
* ``store_steps`` -- Integer representing the number of
interm
i
diate steps ``scan`` should use for a given output. Use
interm
e
diate steps ``scan`` should use for a given output. Use
this key only if you really know what you are doing. In general
i
s recommendat
to let scan decide for you the ammount of memory
i
t is recommended
to let scan decide for you the ammount of memory
it should use.
``scan`` will follow this logic if partial information is given:
...
...
@@ -450,7 +450,7 @@ def scan( fn
:param non_sequences:
``non_sequences`` is the list of arguments that are passed to
``fn`` at each steps. On
c
e can opt to exclude shared variables
``fn`` at each steps. One can opt to exclude shared variables
used in ``fn`` from this list.
...
...
@@ -462,8 +462,8 @@ def scan( fn
outputs will have *0 rows*. If the value is negative, ``scan``
run backwards in time. If the ``go_backwards`` flag is already
set and also ``n_steps`` is negative, ``scan`` will run forward
in time. If
n stpes
is not provided, or evaluates to ``None``,
``inf`` or ``NaN``, ``scan`` will figure out the amount of
in time. If
``n_steps``
is not provided, or evaluates to ``None``,
``inf`` or ``NaN``,
then
``scan`` will figure out the amount of
steps it should run given its input sequences.
...
...
@@ -495,8 +495,8 @@ def scan( fn
:param mode:
It is recommended to leave this argument to None, especially
when profiling ``scan`` (otherwise the results are not going to
be accurate). If you prefer the computations of one step o
s
``scan`` to be done differently
then the entire function
set
be accurate). If you prefer the computations of one step o
f
``scan`` to be done differently
compared to the entire function,
set
this parameters (see ``theano.function`` for details about
possible values and their meaning).
...
...
@@ -633,7 +633,7 @@ def scan( fn
elif
(
not
outs_info
[
i
]
.
get
(
'initial'
,
None
))
and
\
(
outs_info
[
i
]
.
get
(
'taps'
,
None
)):
raise
ValueError
(
'If you are using slices of an output you need to '
\
'provide a initial state for it'
,
outs_info
[
i
])
'provide a
n
initial state for it'
,
outs_info
[
i
])
# if there is an intial state but no tap, we will add the default value
# for taps, namely [-1] ( previous value); not that this will happen
# even though you have provided for taps the value None, which is a bit
...
...
@@ -643,7 +643,7 @@ def scan( fn
elif
outs_info
[
i
]
.
get
(
'initial'
,
None
)
and
\
(
not
outs_info
[
i
]
.
get
(
'taps'
,
None
)):
if
outs_info
[
i
]
.
has_key
(
'taps'
):
warning
(
'You are providing a initial state for an output and then '
warning
(
'You are providing a
n
initial state for an output and then '
'tell scan not to use it. Why? Scan will overwrite this setting'
' and use the previous value of the provided initial state. If'
' this is not what you wanted, check your code and do not '
...
...
@@ -729,7 +729,7 @@ def scan( fn
# go through outputs picking up time slices as needed
for
i
,
init_out
in
enumerate
(
outs_info
):
# Note that our convention dictates that if an output uses
# just the previous time step, as a initial state we will only provide
# just the previous time step, as a
n
initial state we will only provide
# a tensor of the same dimension as one time step; This makes code
# much cleaner for those who do not use taps. Otherwise they would
# always had to shape_pad_left the initial state .. which is ugly
...
...
@@ -1565,7 +1565,7 @@ class Scan(Op):
for
x
in
self
.
store_steps
[:
self
.
n_outs_not_shared
]:
if
x
>
0
:
raise
ValueError
(
'Can not compute gradients if one does not '
,
'store all interm
i
diate results (remove store_steps'
'store all interm
e
diate results (remove store_steps'
'from the dictionaries describing your outputs)'
)
g_scan
=
ScanGrad
((
inner_gfn_ins
,
inner_gfn_outs
),
self
.
n_seqs
,
self
.
n_outs
,
self
.
n_outs_not_shared
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论