Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
710e6b48
提交
710e6b48
authored
1月 18, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a new prepare_node() method that can be used to do stuff 'just
before' make_thunk and help DebugMode work correctly.
上级
3a0de13a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
5 行删除
+19
-5
debugmode.py
theano/compile/debugmode.py
+6
-2
op.py
theano/gof/op.py
+13
-3
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
710e6b48
...
...
@@ -1784,8 +1784,8 @@ class _VariableEquivalenceTracker(object):
# List of default version of make thunk.
# This is needed to know if the user overrided it.
# The GpuOp will be added here when theano.sandbox.cuda is imported.
default_make_thunk
=
[
get_unbound_function
(
theano
.
gof
.
Op
.
make_thunk
)
,
get_unbound_function
(
theano
.
gof
.
OpenMPOp
.
make_thunk
)]
default_make_thunk
=
[
get_unbound_function
(
theano
.
gof
.
Op
.
make_thunk
)
]
# Debug mode cheats and initializes the linker in a different way in
...
...
@@ -1879,6 +1879,10 @@ class _Linker(gof.link.LocalLinker):
thunk
.
inputs
=
[
storage_map
[
v
]
for
v
in
node
.
inputs
]
thunk
.
outputs
=
[
storage_map
[
v
]
for
v
in
node
.
outputs
]
thunk_other
=
thunk
else
:
new_node
=
node
.
op
.
prepare_node
(
node
)
if
new_node
is
not
None
:
node
=
new_node
try
:
if
not
self
.
maker
.
mode
.
check_c_code
:
...
...
theano/gof/op.py
浏览文件 @
710e6b48
...
...
@@ -821,6 +821,14 @@ class Op(utils.object2, PureOp, CLinkerOp):
else
:
return
NotImplemented
def
prepare_node
(
self
,
node
):
"""
Make any special modifications that the Op needs before doing
make_thunk().
"""
pass
def
make_c_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
"""
Like make_thunk, but will only try to make a C thunk.
...
...
@@ -930,6 +938,10 @@ class Op(utils.object2, PureOp, CLinkerOp):
"""
logger
=
logging
.
getLogger
(
'theano.gof.op.Op'
)
new_node
=
self
.
prepare_node
(
self
,
node
)
if
new_node
is
not
None
:
node
=
new_node
if
self
.
_op_use_c_code
:
try
:
return
self
.
make_c_thunk
(
node
,
storage_map
,
compute_map
,
...
...
@@ -1166,10 +1178,8 @@ int main( int argc, const char* argv[] )
self
.
openmp
=
False
theano
.
config
.
openmp
=
False
def
make_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
def
prepare_node
(
self
,
node
):
self
.
update_self_openmp
()
return
super
(
OpenMPOp
,
self
)
.
make_thunk
(
node
,
storage_map
,
compute_map
,
no_recycling
)
def
simple_meth
(
tag
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论