Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6aa3ba4a
提交
6aa3ba4a
authored
11月 28, 2020
作者:
Michael Osthege
提交者:
Brandon T. Willard
12月 04, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use only standard library dependencies in theano.configparser
上级
0d34af2e
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
8 行删除
+13
-8
configparser.py
theano/configparser.py
+13
-8
没有找到文件。
theano/configparser.py
浏览文件 @
6aa3ba4a
# For flag of bool type, we consider the strings 'False', 'false' and '0'
# as False, and the string s'True', 'true', '1' as True.
# We also accept the bool type as its corresponding value!
import
configparser
as
ConfigParser
import
configparser
as
ConfigParser
import
hashlib
import
logging
import
logging
import
os
import
os
import
shlex
import
shlex
...
@@ -12,8 +8,6 @@ import warnings
...
@@ -12,8 +8,6 @@ import warnings
from
functools
import
wraps
from
functools
import
wraps
from
io
import
StringIO
from
io
import
StringIO
import
theano
_logger
=
logging
.
getLogger
(
"theano.configparser"
)
_logger
=
logging
.
getLogger
(
"theano.configparser"
)
...
@@ -188,6 +182,17 @@ def _config_print(thing, buf, print_doc=True):
...
@@ -188,6 +182,17 @@ def _config_print(thing, buf, print_doc=True):
print
(
""
,
file
=
buf
)
print
(
""
,
file
=
buf
)
def
_hash_from_code
(
msg
):
"""This function was copied from theano.gof.utils to get rid of that import."""
# hashlib.sha256() requires an object that supports buffer interface,
# but Python 3 (unicode) strings don't.
if
isinstance
(
msg
,
str
):
msg
=
msg
.
encode
()
# Python 3 does not like module names that start with
# a digit.
return
"m"
+
hashlib
.
sha256
(
msg
)
.
hexdigest
()
def
get_config_hash
():
def
get_config_hash
():
"""
"""
Return a string sha256 of the current config options. In the past,
Return a string sha256 of the current config options. In the past,
...
@@ -201,7 +206,7 @@ def get_config_hash():
...
@@ -201,7 +206,7 @@ def get_config_hash():
all_opts
=
sorted
(
all_opts
=
sorted
(
[
c
for
c
in
_config_var_list
if
c
.
in_c_key
],
key
=
lambda
cv
:
cv
.
fullname
[
c
for
c
in
_config_var_list
if
c
.
in_c_key
],
key
=
lambda
cv
:
cv
.
fullname
)
)
return
theano
.
gof
.
utils
.
hash_from_code
(
return
_
hash_from_code
(
"
\n
"
.
join
(
"
\n
"
.
join
(
[
"{} = {}"
.
format
(
cv
.
fullname
,
cv
.
__get__
(
True
,
None
))
for
cv
in
all_opts
]
[
"{} = {}"
.
format
(
cv
.
fullname
,
cv
.
__get__
(
True
,
None
))
for
cv
in
all_opts
]
)
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论