Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0b5aa217
提交
0b5aa217
authored
8月 11, 2015
作者:
Frederic
提交者:
Arnaud Bergeron
8月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add config var NanGuardMode.{nan,inf,big}_is_error
上级
6c4738d6
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
47 行增加
和
2 行删除
+47
-2
config.txt
doc/library/config.txt
+18
-0
nanguardmode.py
theano/compile/nanguardmode.py
+29
-2
没有找到文件。
doc/library/config.txt
浏览文件 @
0b5aa217
...
@@ -705,6 +705,24 @@ import theano and print the config variable, as in:
...
@@ -705,6 +705,24 @@ import theano and print the config variable, as in:
Generate a warning when the destroy_map or view_map tell that an op work
Generate a warning when the destroy_map or view_map tell that an op work
inplace, but the op did not reuse the input for its output.
inplace, but the op did not reuse the input for its output.
.. attribute:: config.NanGuardMode.nan_is_error
Bool value, default: True
Do NanGuardMode generate an error when it see a nan.
.. attribute:: config.NanGuardMode.inf_is_error
Bool value, default: True
Do NanGuardMode generate an error when it see an inf.
.. attribute:: config.NanGuardMode.nan_is_error
Bool value, default: True
Do NanGuardMode generate an error when it see a big value (>1e10).
.. attribute:: numpy
.. attribute:: numpy
This section contains different attributes for configuring numpy's
This section contains different attributes for configuring numpy's
...
...
theano/compile/nanguardmode.py
浏览文件 @
0b5aa217
import
logging
import
collections
import
collections
import
logging
import
numpy
as
np
import
numpy
as
np
import
theano
import
theano
from
theano.configparser
import
config
,
AddConfigVar
,
BoolParam
import
theano.tensor
as
T
import
theano.tensor
as
T
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda
as
cuda
from
theano.compile
import
Mode
from
theano.compile
import
Mode
AddConfigVar
(
'NanGuardMode.nan_is_error'
,
"Default value for nan_is_error"
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'NanGuardMode.inf_is_error'
,
"Default value for inf_is_error"
,
BoolParam
(
True
),
in_c_key
=
False
)
AddConfigVar
(
'NanGuardMode.big_is_error'
,
"Default value for big_is_error"
,
BoolParam
(
True
),
in_c_key
=
False
)
logger
=
logging
.
getLogger
(
"theano.compile.nanguardmode"
)
logger
=
logging
.
getLogger
(
"theano.compile.nanguardmode"
)
...
@@ -116,10 +134,19 @@ class NanGuardMode(Mode):
...
@@ -116,10 +134,19 @@ class NanGuardMode(Mode):
"""
"""
# We currently loose the 3 first param freuquently, when calling
# We currently loose the 3 first param freuquently, when calling
# mode.including() and variant.
# mode.including() and variant.
def
__init__
(
self
,
nan_is_error
=
True
,
inf_is_error
=
True
,
big_is_error
=
Tru
e
,
def
__init__
(
self
,
nan_is_error
=
None
,
inf_is_error
=
None
,
big_is_error
=
Non
e
,
optimizer
=
None
,
linker
=
None
):
optimizer
=
None
,
linker
=
None
):
self
.
provided_optimizer
=
optimizer
self
.
provided_optimizer
=
optimizer
cuda_compile_failed
=
False
cuda_compile_failed
=
False
if
nan_is_error
is
None
:
nan_is_error
=
config
.
NanGuardMode
.
nan_is_error
if
inf_is_error
is
None
:
inf_is_error
=
config
.
NanGuardMode
.
inf_is_error
if
big_is_error
is
None
:
big_is_error
=
config
.
NanGuardMode
.
big_is_error
assert
nan_is_error
or
inf_is_error
or
big_is_error
if
cuda
.
cuda_available
:
if
cuda
.
cuda_available
:
self
.
guard_input
=
cuda
.
fvector
(
'nan_guard'
)
self
.
guard_input
=
cuda
.
fvector
(
'nan_guard'
)
if
nan_is_error
or
inf_is_error
:
if
nan_is_error
or
inf_is_error
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论