Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
87d0ddc3
提交
87d0ddc3
authored
12月 12, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zip -> izip
上级
3825925b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
8 行删除
+9
-8
scan_utils.py
theano/scan_module/scan_utils.py
+9
-8
没有找到文件。
theano/scan_module/scan_utils.py
浏览文件 @
87d0ddc3
...
...
@@ -15,6 +15,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import
copy
import
logging
from
itertools
import
izip
import
numpy
...
...
@@ -291,7 +292,7 @@ def equal_computations(xs, ys, in_xs=None, in_ys=None):
if
in_ys
is
None
:
in_ys
=
[]
for
x
,
y
in
zip
(
xs
,
ys
):
for
x
,
y
in
i
zip
(
xs
,
ys
):
if
x
.
owner
and
not
y
.
owner
:
return
False
if
y
.
owner
and
not
x
.
owner
:
...
...
@@ -301,7 +302,7 @@ def equal_computations(xs, ys, in_xs=None, in_ys=None):
return
False
if
len
(
in_xs
)
!=
len
(
in_ys
):
return
False
for
_x
,
_y
in
zip
(
in_xs
,
in_ys
):
for
_x
,
_y
in
i
zip
(
in_xs
,
in_ys
):
if
_x
.
type
!=
_y
.
type
:
return
False
...
...
@@ -313,7 +314,7 @@ def equal_computations(xs, ys, in_xs=None, in_ys=None):
n_nodes
=
len
(
nds_x
)
cont
=
True
idx
=
0
for
dx
,
dy
in
zip
(
xs
,
ys
):
for
dx
,
dy
in
i
zip
(
xs
,
ys
):
if
not
dx
.
owner
or
not
dy
.
owner
:
if
dy
.
owner
or
dx
.
owner
:
return
False
...
...
@@ -338,7 +339,7 @@ def equal_computations(xs, ys, in_xs=None, in_ys=None):
elif
len
(
nd_x
.
outputs
)
!=
len
(
nd_y
.
outputs
):
cont
=
False
else
:
for
dx
,
dy
in
zip
(
nd_x
.
inputs
,
nd_y
.
inputs
):
for
dx
,
dy
in
i
zip
(
nd_x
.
inputs
,
nd_y
.
inputs
):
if
(
dx
,
dy
)
not
in
common
:
if
dx
!=
dy
:
if
(
isinstance
(
dx
,
tensor
.
Constant
)
and
...
...
@@ -353,7 +354,7 @@ def equal_computations(xs, ys, in_xs=None, in_ys=None):
cont
=
False
if
cont
:
for
dx
,
dy
in
zip
(
nd_x
.
outputs
,
nd_y
.
outputs
):
for
dx
,
dy
in
i
zip
(
nd_x
.
outputs
,
nd_y
.
outputs
):
common
.
add
((
dx
,
dy
))
idx
+=
1
...
...
@@ -372,7 +373,7 @@ def infer_shape(outs, inputs, input_shapes):
# inside. We don't use the full ShapeFeature interface, but we
# let it initialize itself with an empty env, otherwise we will
# need to do it manually
for
inp
,
inp_shp
in
zip
(
inputs
,
input_shapes
):
for
inp
,
inp_shp
in
i
zip
(
inputs
,
input_shapes
):
if
inp_shp
is
not
None
and
len
(
inp_shp
)
!=
inp
.
ndim
:
assert
len
(
inp_shp
)
==
inp
.
ndim
...
...
@@ -380,7 +381,7 @@ def infer_shape(outs, inputs, input_shapes):
shape_feature
.
on_attach
(
theano
.
gof
.
Env
([],
[]))
# Initialize shape_of with the input shapes
for
inp
,
inp_shp
in
zip
(
inputs
,
input_shapes
):
for
inp
,
inp_shp
in
i
zip
(
inputs
,
input_shapes
):
shape_feature
.
set_shape
(
inp
,
inp_shp
)
def
local_traverse
(
out
):
...
...
@@ -689,7 +690,7 @@ def reconstruct_graph(inputs, outputs, tag=None):
tag
=
''
nw_inputs
=
[
safe_new
(
x
,
tag
)
for
x
in
inputs
]
givens
=
{}
for
nw_x
,
x
in
zip
(
nw_inputs
,
inputs
):
for
nw_x
,
x
in
i
zip
(
nw_inputs
,
inputs
):
givens
[
x
]
=
nw_x
allinputs
=
theano
.
gof
.
graph
.
inputs
(
outputs
)
for
inp
in
allinputs
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论