Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
fdbe417b
提交
fdbe417b
authored
8月 10, 2015
作者:
Frederic
提交者:
Arnaud Bergeron
8月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make flag mode=NanGuardMode work and make it user provided optimizer
上级
5922a930
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
16 行增加
和
4 行删除
+16
-4
mode.py
theano/compile/mode.py
+6
-1
nanguardmode.py
theano/compile/nanguardmode.py
+9
-3
configdefaults.py
theano/configdefaults.py
+1
-0
没有找到文件。
theano/compile/mode.py
浏览文件 @
fdbe417b
...
@@ -387,12 +387,17 @@ def get_mode(orig_string):
...
@@ -387,12 +387,17 @@ def get_mode(orig_string):
default_mode_class
):
default_mode_class
):
return
instanciated_default_mode
return
instanciated_default_mode
if
string
in
[
'Mode'
,
'ProfileMode'
,
'DebugMode'
]:
if
string
in
[
'Mode'
,
'ProfileMode'
,
'DebugMode'
,
'NanGuardMode'
]:
if
string
==
'DebugMode'
:
if
string
==
'DebugMode'
:
# need to import later to break circular dependency.
# need to import later to break circular dependency.
from
.debugmode
import
DebugMode
from
.debugmode
import
DebugMode
# DebugMode use its own linker.
# DebugMode use its own linker.
ret
=
DebugMode
(
optimizer
=
config
.
optimizer
)
ret
=
DebugMode
(
optimizer
=
config
.
optimizer
)
elif
string
==
'NanGuardMode'
:
# need to import later to break circular dependency.
from
.nanguardmode
import
NanGuardMode
# DebugMode use its own linker.
ret
=
NanGuardMode
(
True
,
True
,
True
,
optimizer
=
config
.
optimizer
)
else
:
else
:
# This might be required if the string is 'ProfileMode'
# This might be required if the string is 'ProfileMode'
from
.profilemode
import
ProfileMode
# noqa
from
.profilemode
import
ProfileMode
# noqa
...
...
theano/compile/nanguardmode.py
浏览文件 @
fdbe417b
...
@@ -110,9 +110,15 @@ class NanGuardMode(Mode):
...
@@ -110,9 +110,15 @@ class NanGuardMode(Mode):
big_is_error : bool
big_is_error : bool
If True, raise an error when a value greater than 1e10 is encountered.
If True, raise an error when a value greater than 1e10 is encountered.
Note
----
We ignore the linker parameter
"""
"""
# We currently loose the 3 first param freuquently, when calling
def
__init__
(
self
,
nan_is_error
,
inf_is_error
,
big_is_error
=
True
):
# mode.including() and variant.
def
__init__
(
self
,
nan_is_error
=
True
,
inf_is_error
=
True
,
big_is_error
=
True
,
optimizer
=
None
,
linker
=
None
):
self
.
provided_optimizer
=
optimizer
cuda_compile_failed
=
False
cuda_compile_failed
=
False
if
cuda
.
cuda_available
:
if
cuda
.
cuda_available
:
self
.
guard_input
=
cuda
.
fvector
(
'nan_guard'
)
self
.
guard_input
=
cuda
.
fvector
(
'nan_guard'
)
...
@@ -246,4 +252,4 @@ class NanGuardMode(Mode):
...
@@ -246,4 +252,4 @@ class NanGuardMode(Mode):
wrap_linker
=
theano
.
gof
.
WrapLinker
([
theano
.
gof
.
OpWiseCLinker
()],
wrap_linker
=
theano
.
gof
.
WrapLinker
([
theano
.
gof
.
OpWiseCLinker
()],
nan_check
)
nan_check
)
super
(
NanGuardMode
,
self
)
.
__init__
(
wrap_linker
,
super
(
NanGuardMode
,
self
)
.
__init__
(
wrap_linker
,
optimizer
=
theano
.
config
.
optimizer
)
optimizer
=
self
.
provided_
optimizer
)
theano/configdefaults.py
浏览文件 @
fdbe417b
...
@@ -150,6 +150,7 @@ AddConfigVar(
...
@@ -150,6 +150,7 @@ AddConfigVar(
'mode'
,
'mode'
,
"Default compilation mode"
,
"Default compilation mode"
,
EnumStr
(
'Mode'
,
'ProfileMode'
,
'DebugMode'
,
'FAST_RUN'
,
EnumStr
(
'Mode'
,
'ProfileMode'
,
'DebugMode'
,
'FAST_RUN'
,
'NanGuardMode'
,
'FAST_COMPILE'
,
'PROFILE_MODE'
,
'DEBUG_MODE'
),
'FAST_COMPILE'
,
'PROFILE_MODE'
,
'DEBUG_MODE'
),
in_c_key
=
False
)
in_c_key
=
False
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论