Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1b2c02ae
提交
1b2c02ae
authored
5月 21, 2010
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove extra outdated comments + fixed bug in case return_steps =1, and n_steps =1 or -1
上级
5d9d2303
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
2 行增加
和
24 行删除
+2
-24
scan.py
theano/scan.py
+2
-24
没有找到文件。
theano/scan.py
浏览文件 @
1b2c02ae
...
@@ -716,14 +716,6 @@ def scan(fn, sequences=[], outputs_info=[], non_sequences=[],
...
@@ -716,14 +716,6 @@ def scan(fn, sequences=[], outputs_info=[], non_sequences=[],
# make the compilation as fast as possible by not applying any optimization
# make the compilation as fast as possible by not applying any optimization
# or conversion to C [ note this region is not important for performance
# or conversion to C [ note this region is not important for performance
# so we can do stuff as unoptimal as we wish ]
# so we can do stuff as unoptimal as we wish ]
'''
Why did I use gof.graph.inputs to pick the inputs here ??
dummy_f = function(filter(lambda x: isinstance(x,gof.Variable) and
\
not isinstance(x,SharedVariable) and not isinstance(x,gof.Constant),
\
reversed(gof.graph.inputs(dummy_args))), outputs, updates = updates, mode =
\
compile.mode.Mode(linker = 'py', optimizer = None) )
'''
if
n_fixed_steps
in
[
-
1
,
1
]:
if
n_fixed_steps
in
[
-
1
,
1
]:
''' We do have a special case here, namely is so might happen that
''' We do have a special case here, namely is so might happen that
whatever we have in dummy_args is not sufficient to compile the
whatever we have in dummy_args is not sufficient to compile the
...
@@ -872,22 +864,8 @@ def scan(fn, sequences=[], outputs_info=[], non_sequences=[],
...
@@ -872,22 +864,8 @@ def scan(fn, sequences=[], outputs_info=[], non_sequences=[],
else
:
else
:
# If we do not actually need scan
# If we do not actually need scan
for
pos
,
inner_out
in
enumerate
(
inner_fn_outs
):
for
pos
,
inner_out
in
enumerate
(
inner_fn_outs
):
# check if we are suppose to return just the last step
if
isinstance
(
inner_out
.
type
,
tensor
.
TensorType
):
# we treat this case differently because the tensor we return
inner_fn_outs
[
pos
]
=
tensor
.
unbroadcast
(
tensor
.
shape_padleft
(
inner_out
),
0
)
# in this case is different (it has one dimension less)
if
return_steps
.
has_key
(
pos
):
if
return_steps
[
pos
]
!=
1
:
# if we return more then one step, we need to add
# one more dimension to our output and make it
# unbroadcastable
inner_fn_outs
[
pos
]
=
tensor
.
unbroadcast
(
tensor
.
shape_padleft
(
inner_out
),
0
)
else
:
# same if we do not have any information about how many
# steps we should return (to read return everything in this
# case
inner_fn_outs
[
pos
]
=
tensor
.
unbroadcast
(
tensor
.
shape_padleft
(
inner_out
),
0
)
values
=
inner_fn_outs
values
=
inner_fn_outs
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论