Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3825925b
提交
3825925b
authored
12月 12, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zip -> izip and minor typo fix
上级
861fea2a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
7 行增加
和
6 行删除
+7
-6
scan_op.py
theano/scan_module/scan_op.py
+7
-6
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
3825925b
...
...
@@ -15,6 +15,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import
itertools
import
logging
import
time
from
itertools
import
izip
import
numpy
...
...
@@ -285,7 +286,7 @@ class Scan(PureOp):
# If everything went OK up to here, there is still one thing to
# check. Namely, do the internal graph represent same
# computations
for
self_in
,
other_in
in
zip
(
self
.
inputs
,
other
.
inputs
):
for
self_in
,
other_in
in
i
zip
(
self
.
inputs
,
other
.
inputs
):
if
self_in
.
type
!=
other_in
.
type
:
return
False
...
...
@@ -909,12 +910,12 @@ class Scan(PureOp):
# Here, we build a list inner_ins_shape, such that inner_ins_shape[i]
# is the shape of self.inputs[i]
for
inp
,
inp_shp
in
zip
(
node
.
inputs
,
input_shapes
):
for
inp
,
inp_shp
in
i
zip
(
node
.
inputs
,
input_shapes
):
assert
inp_shp
is
None
or
len
(
inp_shp
)
==
inp
.
ndim
# sequences
# We skip iputs_shapes[0] as it is the total or current number
# of iteration
# of iteration
s.
seqs_shape
=
[
x
[
1
:]
for
x
in
input_shapes
[
1
:
1
+
self
.
n_seqs
]]
# mit_mot, mit_sot, sit_sot
...
...
@@ -938,7 +939,7 @@ class Scan(PureOp):
# node.inputs
inner_non_sequences
=
self
.
inputs
[
len
(
seqs_shape
)
+
len
(
outs_shape
):]
out_equivalent
=
{}
for
in_ns
,
out_ns
in
zip
(
inner_non_sequences
,
node
.
inputs
[
offset
:]):
for
in_ns
,
out_ns
in
i
zip
(
inner_non_sequences
,
node
.
inputs
[
offset
:]):
out_equivalent
[
in_ns
]
=
out_ns
if
self
.
as_while
:
self_outs
=
self
.
outputs
[:
-
1
]
...
...
@@ -971,7 +972,7 @@ class Scan(PureOp):
r
=
node
.
outputs
[
n_outs
+
x
]
assert
r
.
ndim
==
1
+
len
(
out_shape_x
)
shp
=
[
node
.
inputs
[
offset
+
self
.
n_shared_outs
+
x
]]
for
i
,
shp_i
in
zip
(
xrange
(
1
,
r
.
ndim
),
out_shape_x
):
for
i
,
shp_i
in
i
zip
(
xrange
(
1
,
r
.
ndim
),
out_shape_x
):
# Validate shp_i. v_shape_i is either None (if invalid),
# or a (variable, Boolean) tuple. The Boolean indicates
# whether variable is shp_i (if True), or an valid
...
...
@@ -993,7 +994,7 @@ class Scan(PureOp):
# leading dimension so we replace it for every entry with Shape_i
if
self
.
as_while
:
scan_outs
=
[(
Shape_i
(
0
)(
o
),)
+
x
[
1
:]
for
o
,
x
in
zip
(
node
.
outputs
,
scan_outs
)]
for
o
,
x
in
izip
(
node
.
outputs
,
scan_outs
)]
return
scan_outs
### GRAD FUNCTION
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论