Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2deb19cb
提交
2deb19cb
authored
5月 11, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some more ShapeError fixes, and moved ShapeError to tensor.basic to avoid import issues
上级
35ff6f6a
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
13 行增加
和
13 行删除
+13
-13
apply_shape.py
theano/gof/apply_shape.py
+1
-1
basic.py
theano/tensor/basic.py
+8
-3
conv.py
theano/tensor/nnet/conv.py
+2
-2
opt.py
theano/tensor/opt.py
+2
-7
没有找到文件。
theano/gof/apply_shape.py
浏览文件 @
2deb19cb
...
...
@@ -36,7 +36,7 @@ class Apply(gof.Apply):
try
:
oshapes
=
infer_shape
(
self
,
ishapes
)
except
theano
.
tensor
.
opt
.
ShapeError
:
except
theano
.
tensor
.
ShapeError
:
return
for
o
,
oshp
in
zip
(
outputs
,
oshapes
):
...
...
theano/tensor/basic.py
浏览文件 @
2deb19cb
...
...
@@ -45,6 +45,11 @@ int_dtypes = map(str, scal.int_types)
discrete_dtypes
=
map
(
str
,
scal
.
discrete_types
)
class
ShapeError
(
Exception
):
"""Raised when the shape cannot be computed."""
pass
def
check_equal_numpy
(
x
,
y
):
"""
Returns True iff x and y are equal (checks the dtype and
...
...
@@ -3576,14 +3581,14 @@ class Join(Op):
# that whenever I get a None. Should we just remove gof/apply_shape
# if it is depricated ??
if
ishapes
[
1
]
is
None
:
raise
NotImplementedError
raise
ShapeError
()
n_dim
=
len
(
ishapes
[
1
])
for
shape
in
ishapes
[
1
:]:
if
shape
is
None
:
raise
NotImplementedError
raise
ShapeError
()
for
shape_i
in
shape
:
if
shape_i
is
None
:
raise
NotImplementedError
raise
ShapeError
()
# at this point the inputs have been broadcasted so they should
# all have the same shape
assert
len
(
shape
)
==
n_dim
...
...
theano/tensor/nnet/conv.py
浏览文件 @
2deb19cb
...
...
@@ -575,14 +575,14 @@ class ConvOp(Op):
try
:
fmshp
=
ConvOp
.
getOutputShape
(
imshp
[
1
:],
kshp
,
(
self
.
dx
,
self
.
dy
),
self
.
out_mode
)
except
TypeError
:
raise
theano
.
tensor
.
opt
.
ShapeError
()
raise
theano
.
tensor
.
ShapeError
()
outshp
=
(
batch_size
,
fmo
)
+
tuple
(
fmshp
)
return
[
outshp
]
else
:
# Haven't implemented this case. imshp and kshp may be symbollic
# and ConvOp.getOutputShape doesn't handle this. In this case
# we simply let the default function do its work.
raise
theano
.
tensor
.
opt
.
ShapeError
()
raise
theano
.
tensor
.
ShapeError
()
def
perform
(
self
,
node
,
inp
,
out
):
...
...
theano/tensor/opt.py
浏览文件 @
2deb19cb
...
...
@@ -27,17 +27,12 @@ from theano import compile #to register the optimizer built by this file
from
theano.gof.python25
import
any
,
all
from
theano.gof.opt
import
Optimizer
,
pre_constant_merge
,
pre_greedy_local_optimizer
from
theano.gof
import
toolbox
,
DestroyHandler
from
basic
import
get_constant_value
from
basic
import
get_constant_value
,
ShapeError
# Utilities
class
ShapeError
(
Exception
):
"""Raised when the shape cannot be computed."""
pass
def
out2in
(
*
local_opts
):
"""WRITEME """
return
opt
.
TopoOptimizer
(
opt
.
LocalOptGroup
(
*
local_opts
),
...
...
@@ -727,7 +722,7 @@ class ShapeFeature(object):
'Code called by infer_shape failed raising a '
'NotImplementedError. Raising NotImplementedError to '
'indicate that a shape cannot be computed is no longer '
'supported, and one should now use tensor.
opt.
ShapeError '
'supported, and one should now use tensor.ShapeError '
'instead. The original exception message is:
%
s'
%
e
)
except
Exception
,
e
:
_logger
.
error
(
'Failed to infer_shape from Op
%
s (i_shapes=
%
s):
%
s
%
s'
%
(
node
.
op
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论