Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5c4aafee
提交
5c4aafee
authored
2月 12, 2016
作者:
AdeB
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some circular imports
上级
16474203
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
45 行增加
和
48 行删除
+45
-48
configdefaults.py
theano/configdefaults.py
+39
-4
configparser.py
theano/configparser.py
+4
-3
cmodule.py
theano/gof/cmodule.py
+1
-1
compiledir.py
theano/gof/compiledir.py
+1
-40
没有找到文件。
theano/configdefaults.py
浏览文件 @
5c4aafee
...
@@ -7,15 +7,15 @@ import platform
...
@@ -7,15 +7,15 @@ import platform
import
textwrap
import
textwrap
import
re
import
re
import
socket
import
socket
import
struct
import
theano
import
theano
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
FloatParam
,
IntParam
,
StrParam
,
FloatParam
,
IntParam
,
StrParam
,
TheanoConfigParser
,
THEANO_FLAGS_DICT
)
TheanoConfigParser
,
THEANO_FLAGS_DICT
)
from
theano.gof.compiledir
import
(
local_bitwidth
,
python_int_bitwidth
,
gcc_version_str
)
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.windows
import
call_subprocess_Popen
from
theano.misc.windows
import
call_subprocess_Popen
,
output_subprocess_Popen
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
...
@@ -1097,7 +1097,7 @@ AddConfigVar(
...
@@ -1097,7 +1097,7 @@ AddConfigVar(
'warn.identify_1pexp_bug'
,
'warn.identify_1pexp_bug'
,
'Warn if Theano versions prior to 7987b51 (2011-12-18) could have '
'Warn if Theano versions prior to 7987b51 (2011-12-18) could have '
'yielded a wrong result due to a bug in the is_1pexp function'
,
'yielded a wrong result due to a bug in the is_1pexp function'
,
BoolParam
(
theano
.
configdefaults
.
warn_default
(
'0.4.1'
)),
BoolParam
(
warn_default
(
'0.4.1'
)),
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'on_shape_error'
,
AddConfigVar
(
'on_shape_error'
,
...
@@ -1190,6 +1190,41 @@ period for running processes.""",
...
@@ -1190,6 +1190,41 @@ period for running processes.""",
allow_override
=
False
),
allow_override
=
False
),
in_c_key
=
False
)
in_c_key
=
False
)
try
:
p_out
=
output_subprocess_Popen
([
config
.
cxx
,
'-dumpversion'
])
gcc_version_str
=
p_out
[
0
]
.
strip
()
.
decode
()
except
OSError
:
# Typically means gcc cannot be found.
gcc_version_str
=
'GCC_NOT_FOUND'
def
local_bitwidth
():
"""
Return 32 for 32bit arch, 64 for 64bit arch.
By "architecture", we mean the size of memory pointers (size_t in C),
*not* the size of long int, as it can be different.
"""
# Note that according to Python documentation, `platform.architecture()` is
# not reliable on OS X with universal binaries.
# Also, sys.maxsize does not exist in Python < 2.6.
# 'P' denotes a void*, and the size is expressed in bytes.
return
struct
.
calcsize
(
'P'
)
*
8
def
python_int_bitwidth
():
"""
Return the bit width of Python int (C long int).
Note that it can be different from the size of a memory pointer.
"""
# 'l' denotes a C long int, and the size is expressed in bytes.
return
struct
.
calcsize
(
'l'
)
*
8
compiledir_format_dict
=
{
compiledir_format_dict
=
{
"platform"
:
platform
.
platform
(),
"platform"
:
platform
.
platform
(),
"processor"
:
platform
.
processor
(),
"processor"
:
platform
.
processor
(),
...
...
theano/configparser.py
浏览文件 @
5c4aafee
...
@@ -279,7 +279,7 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
...
@@ -279,7 +279,7 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
try
:
try
:
fetch_val_for_key
(
configparam
.
fullname
)
fetch_val_for_key
(
configparam
.
fullname
)
# The user provided a value, filter it now.
# The user provided a value, filter it now.
configparam
.
__get__
(
root
,
type
(
root
))
configparam
.
__get__
(
root
,
type
(
root
)
,
delete_key
=
True
)
except
KeyError
:
except
KeyError
:
pass
pass
setattr
(
root
.
__class__
,
sections
[
0
],
configparam
)
setattr
(
root
.
__class__
,
sections
[
0
],
configparam
)
...
@@ -307,12 +307,13 @@ class ConfigParam(object):
...
@@ -307,12 +307,13 @@ class ConfigParam(object):
# Calling `filter` here may actually be harmful if the default value is
# Calling `filter` here may actually be harmful if the default value is
# invalid and causes a crash or has unwanted side effects.
# invalid and causes a crash or has unwanted side effects.
def
__get__
(
self
,
cls
,
type_
):
def
__get__
(
self
,
cls
,
type_
,
delete_key
=
False
):
if
cls
is
None
:
if
cls
is
None
:
return
self
return
self
if
not
hasattr
(
self
,
'val'
):
if
not
hasattr
(
self
,
'val'
):
try
:
try
:
val_str
=
fetch_val_for_key
(
self
.
fullname
,
delete_key
=
True
)
val_str
=
fetch_val_for_key
(
self
.
fullname
,
delete_key
=
delete_key
)
self
.
is_default
=
False
self
.
is_default
=
False
except
KeyError
:
except
KeyError
:
if
callable
(
self
.
default
):
if
callable
(
self
.
default
):
...
...
theano/gof/cmodule.py
浏览文件 @
5c4aafee
...
@@ -32,7 +32,7 @@ from theano.misc.windows import (subprocess_Popen,
...
@@ -32,7 +32,7 @@ from theano.misc.windows import (subprocess_Popen,
# we will abuse the lockfile mechanism when reading and writing the registry
# we will abuse the lockfile mechanism when reading and writing the registry
from
theano.gof
import
compilelock
from
theano.gof
import
compilelock
from
theano.
gof.compiledir
import
gcc_version_str
,
local_bitwidth
from
theano.
configdefaults
import
gcc_version_str
,
local_bitwidth
from
theano.configparser
import
AddConfigVar
,
BoolParam
from
theano.configparser
import
AddConfigVar
,
BoolParam
...
...
theano/gof/compiledir.py
浏览文件 @
5c4aafee
from
__future__
import
print_function
from
__future__
import
print_function
import
six.moves.cPickle
as
pickle
import
six.moves.cPickle
as
pickle
import
errno
import
logging
import
logging
import
os
import
os
import
platform
import
re
import
shutil
import
shutil
import
struct
import
socket
import
sys
import
numpy
import
numpy
import
theano
import
theano
from
six
import
string_types
,
iteritems
from
six
import
string_types
,
iteritems
from
theano.configparser
import
config
,
AddConfigVar
,
ConfigParam
,
StrParam
from
theano.configparser
import
config
from
theano.gof.utils
import
flatten
from
theano.gof.utils
import
flatten
from
theano.misc.windows
import
output_subprocess_Popen
from
theano.misc.windows
import
output_subprocess_Popen
_logger
=
logging
.
getLogger
(
"theano.gof.compiledir"
)
_logger
=
logging
.
getLogger
(
"theano.gof.compiledir"
)
try
:
p_out
=
output_subprocess_Popen
([
theano
.
config
.
cxx
,
'-dumpversion'
])
gcc_version_str
=
p_out
[
0
]
.
strip
()
.
decode
()
except
OSError
:
# Typically means gcc cannot be found.
gcc_version_str
=
'GCC_NOT_FOUND'
def
local_bitwidth
():
"""
Return 32 for 32bit arch, 64 for 64bit arch.
By "architecture", we mean the size of memory pointers (size_t in C),
*not* the size of long int, as it can be different.
"""
# Note that according to Python documentation, `platform.architecture()` is
# not reliable on OS X with universal binaries.
# Also, sys.maxsize does not exist in Python < 2.6.
# 'P' denotes a void*, and the size is expressed in bytes.
return
struct
.
calcsize
(
'P'
)
*
8
def
python_int_bitwidth
():
"""
Return the bit width of Python int (C long int).
Note that it can be different from the size of a memory pointer.
"""
# 'l' denotes a C long int, and the size is expressed in bytes.
return
struct
.
calcsize
(
'l'
)
*
8
def
cleanup
():
def
cleanup
():
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论