Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b155c92f
提交
b155c92f
authored
3月 25, 2011
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug recently introduced in ShapeFeature
上级
d1b923fd
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
11 行删除
+13
-11
opt.py
theano/tensor/opt.py
+12
-10
test_opt.py
theano/tensor/tests/test_opt.py
+1
-1
没有找到文件。
theano/tensor/opt.py
浏览文件 @
b155c92f
...
...
@@ -618,11 +618,10 @@ class ShapeFeature(object):
assert
other_r
in
self
.
shape_of
,
(
'other_r not in shape_of'
,
other_r
)
other_shape
=
self
.
shape_of
[
other_r
]
# If no info is known on r's shape, use other_shape
try
:
r_shape
=
self
.
shape_tuple
(
r
)
except
AttributeError
,
e
:
#print e
if
r
in
self
.
shape_of
:
r_shape
=
self
.
shape_of
[
r
]
else
:
# If no info is known on r's shape, use other_shape
self
.
shape_of
[
r
]
=
other_shape
return
...
...
@@ -634,11 +633,14 @@ class ShapeFeature(object):
# Merge other_shape with r_shape, giving the priority to other_shape
merged_shape
=
[]
for
i
,
ps
in
enumerate
(
other_shape
):
# If other_shape[i] is uninformative (if it is just
# Shape_i(i)(other_r)), use r_shape[i]
if
(
isinstance
(
getattr
(
ps
,
'op'
,
None
),
Shape_i
)
and
ps
.
i
==
i
and
ps
.
inputs
[
0
]
==
other_r
):
# If other_shape[i] is uninformative, use r_shape[i].
# For now, we consider 2 cases of uninformative other_shape[i]:
# - Shape_i(i)(other_r);
# - Shape_i(i)(r).
if
(
ps
.
owner
and
isinstance
(
getattr
(
ps
.
owner
,
'op'
,
None
),
Shape_i
)
and
ps
.
owner
.
op
.
i
==
i
and
ps
.
owner
.
inputs
[
0
]
in
(
r
,
other_r
)):
merged_shape
.
append
(
r_shape
[
i
])
else
:
merged_shape
.
append
(
other_shape
[
i
])
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
b155c92f
...
...
@@ -1670,7 +1670,7 @@ class test_shapeoptimizer(unittest.TestCase):
register_specialize
(
local_identity_noshape_to_identity_shape
)
# With the optimization
# The identity_shape op
is
should not be needed anymore to compute
# The identity_shape op should not be needed anymore to compute
# the shape
g
=
theano
.
function
([
x
],
ins_x
.
shape
,
mode
=
mode
)
xval
=
rng
.
randn
(
6
,
1
,
2
)
.
astype
(
config
.
floatX
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论