Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1790864c
提交
1790864c
authored
6月 03, 2015
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add `clone` method to Mode and sub-classes
上级
5fbaa031
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
53 行增加
和
0 行删除
+53
-0
debugmode.py
theano/compile/debugmode.py
+1
-0
mode.py
theano/compile/mode.py
+15
-0
monitormode.py
theano/compile/monitormode.py
+14
-0
profilemode.py
theano/compile/profilemode.py
+23
-0
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
1790864c
...
...
@@ -2620,4 +2620,5 @@ class DebugMode(Mode):
return
"DebugMode(linker=
%
s, optimizer=
%
s)"
%
(
self
.
provided_linker
,
self
.
provided_optimizer
)
register_mode
(
'DEBUG_MODE'
,
DebugMode
(
optimizer
=
'fast_run'
))
theano/compile/mode.py
浏览文件 @
1790864c
...
...
@@ -320,6 +320,21 @@ class Mode(object):
self
.
provided_optimizer
)
return
self
.
__class__
(
linker
=
link
,
optimizer
=
opt
.
requiring
(
*
tags
))
def
clone
(
self
,
link_kwargs
=
None
,
**
kwargs
):
"""
Create a new instance of this Mode.
Keyword arguments can be provided for the linker,
in which case its `clone` method will be called with these
arguments.
"""
new_linker
=
self
.
linker
.
clone
(
**
link_kwargs
)
new_optimizer
=
self
.
provided_optimizer
new_mode
=
type
(
self
)(
linker
=
new_linker
,
optimizer
=
new_optimizer
)
return
new_mode
# If a string is passed as the mode argument in function or
# FunctionMaker, the Mode will be taken from this dictionary using the
# string as the key
...
...
theano/compile/monitormode.py
浏览文件 @
1790864c
...
...
@@ -92,6 +92,20 @@ class MonitorMode(Mode):
ret
.
post_func
=
self
.
post_func
return
ret
def
clone
(
self
,
opt_kwargs
=
None
,
**
kwargs
):
"""
Create a new instance of this Mode.
Keyword arguments can be provided for the linker,
but they will be ignored, because ProfileMode needs
to use its own linker.
"""
new_mode
=
type
(
self
)(
pre_func
=
self
.
pre_func
,
post_func
=
self
.
post_func
,
linker
=
None
,
optimizer
=
self
.
provided_optimizer
)
return
new_mode
def
detect_nan
(
i
,
node
,
fn
):
for
output
in
fn
.
outputs
:
...
...
theano/compile/profilemode.py
浏览文件 @
1790864c
...
...
@@ -695,6 +695,29 @@ Test them first, as they are not guaranteed to always provide a speedup.""")
if
not
printed_tip
:
print
(
" Sorry, no tip for today."
)
def
clone
(
self
,
link_kwargs
=
None
,
message
=
None
):
"""
Create a new instance of this Mode.
Keyword arguments can be provided for the linker,
in which case its `clone` method will be called with these
arguments.
"""
new_linker
=
self
.
linker
.
clone
(
**
link_kwargs
)
new_optimizer
=
self
.
provided_optimizer
new_mode
=
type
(
self
)(
linker
=
new_linker
,
optimizer
=
new_optimizer
)
# If self is in the list or profiles to print, then add the
# new one as well
if
self
in
prof_mode_instance_to_print
:
prof_mode_instance_to_print
.
append
(
new_mode
)
if
message
:
new_mode
.
message
=
message
return
new_mode
register_mode
(
'PROFILE_MODE'
,
ProfileMode
())
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论