Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0d34af2e
提交
0d34af2e
authored
12月 02, 2020
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
12月 02, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix mkl warning in default_blas_ldflags
上级
d660ea78
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
47 行增加
和
32 行删除
+47
-32
test_config.py
tests/test_config.py
+46
-31
configdefaults.py
theano/configdefaults.py
+1
-1
没有找到文件。
tests/test_config.py
浏览文件 @
0d34af2e
"""
"""
Test config options.
Test config options.
"""
"""
import
logging
from
unittest.mock
import
patch
from
theano.configdefaults
import
default_blas_ldflags
from
theano.configparser
import
THEANO_FLAGS_DICT
,
AddConfigVar
,
ConfigParam
from
theano.configparser
import
THEANO_FLAGS_DICT
,
AddConfigVar
,
ConfigParam
class
TestConfig
:
def
test_invalid_default
():
def
test_invalid_default
(
self
):
# Ensure an invalid default value found in the Theano code only causes
# Ensure an invalid default value found in the Theano code only causes
# a crash if it is not overridden by the user.
# a crash if it is not overridden by the user.
def
filter
(
val
):
def
filter
(
val
):
if
val
==
"invalid"
:
if
val
==
"invalid"
:
raise
ValueError
()
raise
ValueError
()
else
:
else
:
return
val
return
val
try
:
try
:
# This should raise a ValueError because the default value is
# This should raise a ValueError because the default value is
# invalid.
# invalid.
AddConfigVar
(
"T_config.test_invalid_default_a"
,
doc
=
"unittest"
,
configparam
=
ConfigParam
(
"invalid"
,
filter
=
filter
),
in_c_key
=
False
,
)
raise
AssertionError
()
except
ValueError
:
pass
THEANO_FLAGS_DICT
[
"T_config.test_invalid_default_b"
]
=
"ok"
# This should succeed since we defined a proper value, even
# though the default was invalid.
AddConfigVar
(
AddConfigVar
(
"T_config.test_invalid_default_
b
"
,
"T_config.test_invalid_default_
a
"
,
doc
=
"unittest"
,
doc
=
"unittest"
,
configparam
=
ConfigParam
(
"invalid"
,
filter
=
filter
),
configparam
=
ConfigParam
(
"invalid"
,
filter
=
filter
),
in_c_key
=
False
,
in_c_key
=
False
,
)
)
raise
AssertionError
()
except
ValueError
:
pass
THEANO_FLAGS_DICT
[
"T_config.test_invalid_default_b"
]
=
"ok"
# This should succeed since we defined a proper value, even
# though the default was invalid.
AddConfigVar
(
"T_config.test_invalid_default_b"
,
doc
=
"unittest"
,
configparam
=
ConfigParam
(
"invalid"
,
filter
=
filter
),
in_c_key
=
False
,
)
# Check that the flag has been removed
assert
"T_config.test_invalid_default_b"
not
in
THEANO_FLAGS_DICT
# TODO We should remove these dummy options on test exit.
@patch
(
"theano.configdefaults.try_blas_flag"
,
return_value
=
None
)
@patch
(
"theano.configdefaults.sys"
)
def
test_default_blas_ldflags
(
sys_mock
,
try_blas_flag_mock
,
caplog
):
sys_mock
.
version
=
"3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:38)
\n
[GCC 7.3.0]"
# Check that the flag has been removed
with
patch
.
dict
(
"sys.modules"
,
{
"mkl"
:
None
}):
assert
"T_config.test_invalid_default_b"
not
in
THEANO_FLAGS_DICT
with
caplog
.
at_level
(
logging
.
WARNING
):
default_blas_ldflags
()
# TODO We should remove these dummy options on test exit.
assert
"install mkl with"
in
caplog
.
text
theano/configdefaults.py
浏览文件 @
0d34af2e
...
@@ -1835,7 +1835,7 @@ def default_blas_ldflags():
...
@@ -1835,7 +1835,7 @@ def default_blas_ldflags():
# the fallback and test -lblas could give slow computation, so
# the fallback and test -lblas could give slow computation, so
# warn about this.
# warn about this.
for
warn
in
warn_record
:
for
warn
in
warn_record
:
_logger
.
warning
(
*
warn
)
_logger
.
warning
(
warn
)
del
warn_record
del
warn_record
# Some environment don't have the lib dir in LD_LIBRARY_PATH.
# Some environment don't have the lib dir in LD_LIBRARY_PATH.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论