Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2b8ea5da
提交
2b8ea5da
authored
4月 27, 2011
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Following Josh suggestion I renamed a function to something more readable.
I've also make the documentation more clear on the actual behaviour of n_steps.
上级
b04fa107
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
6 行删除
+6
-6
scan.py
theano/scan_module/scan.py
+5
-5
scan_utils.py
theano/scan_module/scan_utils.py
+1
-1
没有找到文件。
theano/scan_module/scan.py
浏览文件 @
2b8ea5da
...
@@ -240,9 +240,9 @@ def scan( fn
...
@@ -240,9 +240,9 @@ def scan( fn
outputs will have *0 rows*. If the value is negative, ``scan``
outputs will have *0 rows*. If the value is negative, ``scan``
run backwards in time. If the ``go_backwards`` flag is already
run backwards in time. If the ``go_backwards`` flag is already
set and also ``n_steps`` is negative, ``scan`` will run forward
set and also ``n_steps`` is negative, ``scan`` will run forward
in time. If n stpes is not provided, or
evaluates to ``None``,
in time. If n stpes is not provided, or
is a constant that
``inf`` or ``NaN``, ``scan`` will figure out the amount of
evaluates to ``None``, ``inf`` or ``NaN``, ``scan`` will figure
steps it should run given its input sequences.
out the amount of
steps it should run given its input sequences.
:param truncate_gradient:
:param truncate_gradient:
...
@@ -454,7 +454,7 @@ def scan( fn
...
@@ -454,7 +454,7 @@ def scan( fn
for
seq
in
scan_seqs
:
for
seq
in
scan_seqs
:
lengths_vec
.
append
(
seq
.
shape
[
0
]
)
lengths_vec
.
append
(
seq
.
shape
[
0
]
)
if
not
scan_utils
.
check_NaN_Inf
_None
(
n_steps
):
if
not
scan_utils
.
isNaN_or_Inf_or
_None
(
n_steps
):
# ^ N_steps should also be considered
# ^ N_steps should also be considered
lengths_vec
.
append
(
tensor
.
as_tensor
(
n_steps
)
)
lengths_vec
.
append
(
tensor
.
as_tensor
(
n_steps
)
)
...
@@ -468,7 +468,7 @@ def scan( fn
...
@@ -468,7 +468,7 @@ def scan( fn
# If the user has provided the number of steps, do that regardless ( and
# If the user has provided the number of steps, do that regardless ( and
# raise an error if the sequences are not long enough )
# raise an error if the sequences are not long enough )
if
scan_utils
.
check_NaN_Inf
_None
(
n_steps
):
if
scan_utils
.
isNaN_or_Inf_or
_None
(
n_steps
):
actual_n_steps
=
lengths_vec
[
0
]
actual_n_steps
=
lengths_vec
[
0
]
for
contestant
in
lengths_vec
[
1
:]:
for
contestant
in
lengths_vec
[
1
:]:
actual_n_steps
=
tensor
.
minimum
(
actual_n_steps
,
contestant
)
actual_n_steps
=
tensor
.
minimum
(
actual_n_steps
,
contestant
)
...
...
theano/scan_module/scan_utils.py
浏览文件 @
2b8ea5da
...
@@ -205,7 +205,7 @@ def get_updates_and_outputs(outputs_updates):
...
@@ -205,7 +205,7 @@ def get_updates_and_outputs(outputs_updates):
return
outputs
,
updates
return
outputs
,
updates
def
check_NaN_Inf
_None
(
x
):
def
isNaN_or_Inf_or
_None
(
x
):
isNone
=
x
is
None
isNone
=
x
is
None
try
:
try
:
isNaN
=
numpy
.
isnan
(
x
)
isNaN
=
numpy
.
isnan
(
x
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论