Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cfc2f4e0
提交
cfc2f4e0
authored
8月 07, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add the Theano flag optimizer_verbose
上级
a4580829
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
26 行增加
和
4 行删除
+26
-4
config.txt
doc/library/config.txt
+8
-0
configdefaults.py
theano/configdefaults.py
+5
-0
fg.py
theano/gof/fg.py
+5
-2
toolbox.py
theano/gof/toolbox.py
+8
-2
没有找到文件。
doc/library/config.txt
浏览文件 @
cfc2f4e0
...
...
@@ -482,6 +482,14 @@ import theano and print the config variable, as in:
This flag's value cannot be modified during the program execution.
.. attribute:: optimizer_verbose
Bool value: either True or False
Default: False
When True, we print on the stdout the optimization applied.
.. attribute:: nocleanup
Bool value: either True or False
...
...
theano/configdefaults.py
浏览文件 @
cfc2f4e0
...
...
@@ -157,6 +157,11 @@ AddConfigVar('optimizer',
EnumStr
(
'fast_run'
,
'merge'
,
'fast_compile'
,
'None'
),
in_c_key
=
False
)
AddConfigVar
(
'optimizer_verbose'
,
"If True, we print all optimization being applied"
,
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'on_opt_error'
,
(
"What to do when an optimization crashes: warn and skip it, raise "
"the exception, or fall into the pdb debugger."
),
...
...
theano/gof/fg.py
浏览文件 @
cfc2f4e0
...
...
@@ -413,12 +413,15 @@ class FunctionGraph(utils.object2):
self
.
__prune_r__
([
r
],
reason
=
reason
)
### replace ###
def
replace
(
self
,
r
,
new_r
,
reason
=
None
):
def
replace
(
self
,
r
,
new_r
,
reason
=
None
,
verbose
=
None
):
""" WRITEME
This is the main interface to manipulate the subgraph in FunctionGraph.
For every node that uses r as input, makes it use new_r instead.
"""
if
verbose
is
None
:
verbose
=
config
.
optimizer_verbose
if
verbose
:
print
reason
,
r
,
new_r
if
r
.
fgraph
is
not
self
:
raise
Exception
(
"Cannot replace
%
s because it does not belong to this FunctionGraph"
%
r
,
str
(
reason
))
if
not
r
.
type
==
new_r
.
type
:
...
...
theano/gof/toolbox.py
浏览文件 @
cfc2f4e0
import
sys
import
time
from
theano
import
config
from
theano.gof.python25
import
partial
from
theano.gof.python25
import
OrderedDict
from
theano.gof
import
graph
...
...
@@ -197,11 +198,14 @@ class ReplaceValidate(History, Validator):
def
replace_validate
(
self
,
fgraph
,
r
,
new_r
,
reason
=
None
):
self
.
replace_all_validate
(
fgraph
,
[(
r
,
new_r
)],
reason
=
reason
)
def
replace_all_validate
(
self
,
fgraph
,
replacements
,
reason
=
None
):
def
replace_all_validate
(
self
,
fgraph
,
replacements
,
reason
=
None
,
verbose
=
None
):
chk
=
fgraph
.
checkpoint
()
if
verbose
is
None
:
verbose
=
config
.
optimizer_verbose
for
r
,
new_r
in
replacements
:
try
:
fgraph
.
replace
(
r
,
new_r
,
reason
=
reason
)
fgraph
.
replace
(
r
,
new_r
,
reason
=
reason
,
verbose
=
False
)
except
Exception
,
e
:
if
(
'The type of the replacement must be the same'
not
in
str
(
e
)
and
'does not belong to this FunctionGraph'
not
in
str
(
e
)):
...
...
@@ -217,6 +221,8 @@ class ReplaceValidate(History, Validator):
except
Exception
,
e
:
fgraph
.
revert
(
chk
)
raise
if
verbose
:
print
reason
,
r
,
new_r
return
chk
def
replace_all_validate_remove
(
self
,
fgraph
,
replacements
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论