Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8628ecf9
提交
8628ecf9
authored
12月 19, 2020
作者:
Robert P. Goldman
提交者:
Brandon T. Willard
1月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't warn repeatedly for same un-optimize-able Op
Closes #23.
上级
1bf52120
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
25 行增加
和
23 行删除
+25
-23
debugmode.py
theano/compile/debugmode.py
+5
-20
opt.py
theano/tensor/opt.py
+2
-3
utils.py
theano/utils.py
+18
-0
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
8628ecf9
...
@@ -13,6 +13,7 @@ import sys
...
@@ -13,6 +13,7 @@ import sys
from
io
import
StringIO
from
io
import
StringIO
from
itertools
import
chain
from
itertools
import
chain
from
itertools
import
product
as
itertools_product
from
itertools
import
product
as
itertools_product
from
logging
import
Logger
from
warnings
import
warn
from
warnings
import
warn
import
numpy
as
np
import
numpy
as
np
...
@@ -32,28 +33,11 @@ from theano.gof import graph, ops_with_inner_function
...
@@ -32,28 +33,11 @@ from theano.gof import graph, ops_with_inner_function
from
theano.gof.utils
import
MethodNotDefined
from
theano.gof.utils
import
MethodNotDefined
from
theano.link.basic
import
Container
,
LocalLinker
from
theano.link.basic
import
Container
,
LocalLinker
from
theano.link.utils
import
map_storage
,
raise_with_op
from
theano.link.utils
import
map_storage
,
raise_with_op
from
theano.utils
import
difference
,
get_unbound_function
from
theano.utils
import
NoDuplicateOptWarningFilter
,
difference
,
get_unbound_function
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
_logger
=
logging
.
getLogger
(
"theano.compile.debugmode"
)
_logger
:
Logger
=
logging
.
getLogger
(
"theano.compile.debugmode"
)
# Filter to avoid duplicating optimization warnings
class
NoDuplicateOptWarningFilter
(
logging
.
Filter
):
prev_msgs
=
set
()
def
filter
(
self
,
record
):
msg
=
record
.
getMessage
()
if
msg
.
startswith
(
"Optimization Warning: "
):
if
msg
in
self
.
prev_msgs
:
return
False
else
:
self
.
prev_msgs
.
add
(
msg
)
return
True
return
True
_logger
.
addFilter
(
NoDuplicateOptWarningFilter
())
_logger
.
addFilter
(
NoDuplicateOptWarningFilter
())
...
@@ -538,7 +522,8 @@ def debugprint(
...
@@ -538,7 +522,8 @@ def debugprint(
if
used_ids
is
None
:
if
used_ids
is
None
:
used_ids
=
dict
()
used_ids
=
dict
()
def
get_id_str
(
obj
,
get_printed
=
True
):
def
get_id_str
(
obj
,
get_printed
=
True
)
->
str
:
id_str
:
str
=
""
if
obj
in
used_ids
:
if
obj
in
used_ids
:
id_str
=
used_ids
[
obj
]
id_str
=
used_ids
[
obj
]
elif
obj
==
"output"
:
elif
obj
==
"output"
:
...
...
theano/tensor/opt.py
浏览文件 @
8628ecf9
...
@@ -102,12 +102,11 @@ from theano.tensor.type import (
...
@@ -102,12 +102,11 @@ from theano.tensor.type import (
values_eq_approx_remove_inf_nan
,
values_eq_approx_remove_inf_nan
,
values_eq_approx_remove_nan
,
values_eq_approx_remove_nan
,
)
)
from
theano.utils
import
NoDuplicateOptWarningFilter
# import theano.tensor.basic as tt
_logger
=
logging
.
getLogger
(
"theano.tensor.opt"
)
_logger
=
logging
.
getLogger
(
"theano.tensor.opt"
)
_logger
.
addFilter
(
NoDuplicateOptWarningFilter
())
def
_fill_chain
(
new_out
,
orig_inputs
):
def
_fill_chain
(
new_out
,
orig_inputs
):
...
...
theano/utils.py
浏览文件 @
8628ecf9
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
hashlib
import
hashlib
import
inspect
import
inspect
import
logging
import
os
import
os
import
struct
import
struct
import
subprocess
import
subprocess
...
@@ -25,6 +26,7 @@ __all__ = [
...
@@ -25,6 +26,7 @@ __all__ = [
"output_subprocess_Popen"
,
"output_subprocess_Popen"
,
"LOCAL_BITWIDTH"
,
"LOCAL_BITWIDTH"
,
"PYTHON_INT_BITWIDTH"
,
"PYTHON_INT_BITWIDTH"
,
"NoDuplicateOptWarningFilter"
,
]
]
...
@@ -374,3 +376,19 @@ def flatten(a):
...
@@ -374,3 +376,19 @@ def flatten(a):
return
l
return
l
else
:
else
:
return
[
a
]
return
[
a
]
class
NoDuplicateOptWarningFilter
(
logging
.
Filter
):
"""Filter to avoid duplicating optimization warnings."""
prev_msgs
=
set
()
def
filter
(
self
,
record
):
msg
=
record
.
getMessage
()
if
msg
.
startswith
(
"Optimization Warning: "
):
if
msg
in
self
.
prev_msgs
:
return
False
else
:
self
.
prev_msgs
.
add
(
msg
)
return
True
return
True
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论