Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
27ee5379
提交
27ee5379
authored
2月 16, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow nodes to have a 'debug' behaviour for DebugMode.
上级
e088e2a8
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
21 行增加
和
13 行删除
+21
-13
debugmode.py
theano/compile/debugmode.py
+9
-7
cc.py
theano/gof/cc.py
+7
-5
op.py
theano/gof/op.py
+5
-1
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
27ee5379
...
@@ -1883,8 +1883,10 @@ class _Linker(gof.link.LocalLinker):
...
@@ -1883,8 +1883,10 @@ class _Linker(gof.link.LocalLinker):
if
new_node
is
not
None
:
if
new_node
is
not
None
:
node
=
new_node
node
=
new_node
debug
=
hasattr
(
node
.
op
,
'debug_perform'
)
try
:
try
:
if
not
self
.
maker
.
mode
.
check_c_code
:
if
not
self
.
maker
.
mode
.
check_c_code
or
debug
:
raise
utils
.
MethodNotDefined
()
raise
utils
.
MethodNotDefined
()
# Ops that do not inherit from gof.op.Op don't have certain
# Ops that do not inherit from gof.op.Op don't have certain
# methods defined that the CLinker expects (Scan is an
# methods defined that the CLinker expects (Scan is an
...
@@ -1902,18 +1904,18 @@ class _Linker(gof.link.LocalLinker):
...
@@ -1902,18 +1904,18 @@ class _Linker(gof.link.LocalLinker):
# Pure ops don't really have a perform ( or their perform just
# Pure ops don't really have a perform ( or their perform just
# raises an not implemented exception), so in those cases we
# raises an not implemented exception), so in those cases we
# consider that we don't have a python implementation
# consider that we don't have a python implementation
if
(
self
.
maker
.
mode
.
check_py_code
or
thunks_c
[
-
1
]
is
None
)
and
\
if
(((
self
.
maker
.
mode
.
check_py_code
or
thunks_c
[
-
1
]
is
None
)
and
node
.
op
.
perform
.
__code__
!=
gof
.
op
.
PureOp
.
perform
.
__code__
:
node
.
op
.
perform
.
__code__
!=
gof
.
op
.
PureOp
.
perform
.
__code__
)
or
debug
):
thunk
=
node
.
op
.
make_py_thunk
(
node
,
storage_map
,
compute_map
,
thunk
=
node
.
op
.
make_py_thunk
(
node
,
storage_map
,
compute_map
,
no_recycling
)
no_recycling
,
debug
=
debug
)
thunks_py
.
append
(
thunk
)
thunks_py
.
append
(
thunk
)
else
:
else
:
thunks_py
.
append
(
None
)
thunks_py
.
append
(
None
)
if
not
self
.
maker
.
mode
.
check_c_code
and
thunks_py
[
-
1
]
is
None
:
if
not
self
.
maker
.
mode
.
check_c_code
and
thunks_py
[
-
1
]
is
None
:
_logger
.
warn
(
_logger
.
warn
(
"Op
%
s doesn't have a perform, "
"Op
%
s don't have a perform, forcing check of the c code"
%
"forcing check of the C code"
%
node
.
op
)
node
.
op
)
thunk
=
node
.
op
.
make_c_thunk
(
node
,
storage_map
,
compute_map
,
thunk
=
node
.
op
.
make_c_thunk
(
node
,
storage_map
,
compute_map
,
no_recycling
)
no_recycling
)
thunks_c
[
-
1
]
=
thunk
thunks_c
[
-
1
]
=
thunk
...
...
theano/gof/cc.py
浏览文件 @
27ee5379
...
@@ -1186,11 +1186,13 @@ class CLinker(link.Linker):
...
@@ -1186,11 +1186,13 @@ class CLinker(link.Linker):
List of lists of length 1. In order to use
List of lists of length 1. In order to use
the thunk returned by __compile__, the inputs must be put in
the thunk returned by __compile__, the inputs must be put in
that storage. If None, storage will be allocated.
that storage. If None, storage will be allocated.
@param output_storage: list of lists of length 1. The thunk returned
output_storage: list of lists of length 1.
by __compile__ will put the variables of the computation in these
The thunk returned by __compile__ will put the variables
lists. If None, storage will be allocated.
of the computation in these lists. If None, storage will
@param storage_map: dict that map variables to storages. This is used
be allocated.
when you need to customize the storage of this thunk.
storage_map: dict that map variables to storages.
This is used when you need to customize the storage of
this thunk.
Returns: thunk, input_storage, output_storage
Returns: thunk, input_storage, output_storage
...
...
theano/gof/op.py
浏览文件 @
27ee5379
...
@@ -890,7 +890,8 @@ class Op(utils.object2, PureOp, CLinkerOp):
...
@@ -890,7 +890,8 @@ class Op(utils.object2, PureOp, CLinkerOp):
rval
.
lazy
=
False
rval
.
lazy
=
False
return
rval
return
rval
def
make_py_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
def
make_py_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
,
debug
=
False
):
"""
"""
Like make_thunk() but only makes python thunks.
Like make_thunk() but only makes python thunks.
...
@@ -898,6 +899,9 @@ class Op(utils.object2, PureOp, CLinkerOp):
...
@@ -898,6 +899,9 @@ class Op(utils.object2, PureOp, CLinkerOp):
node_input_storage
=
[
storage_map
[
r
]
for
r
in
node
.
inputs
]
node_input_storage
=
[
storage_map
[
r
]
for
r
in
node
.
inputs
]
node_output_storage
=
[
storage_map
[
r
]
for
r
in
node
.
outputs
]
node_output_storage
=
[
storage_map
[
r
]
for
r
in
node
.
outputs
]
if
debug
:
p
=
node
.
op
.
debug_perform
else
:
p
=
node
.
op
.
perform
p
=
node
.
op
.
perform
params
=
node
.
run_params
()
params
=
node
.
run_params
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论