Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
700d883b
提交
700d883b
authored
7月 10, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flake8 of theano/gof/cmodule.py
上级
bee83a7a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
20 行删除
+21
-20
cmodule.py
theano/gof/cmodule.py
+21
-19
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
700d883b
"""Generate and compile C modules for Python,
"""Generate and compile C modules for Python,
"""
"""
from
__future__
import
print_function
from
__future__
import
print_function
import
atexit
import
atexit
import
six.moves.cPickle
as
pickle
import
six.moves.cPickle
as
pickle
import
logging
import
logging
...
@@ -15,12 +17,6 @@ import time
...
@@ -15,12 +17,6 @@ import time
import
platform
import
platform
import
distutils.sysconfig
import
distutils.sysconfig
importlib
=
None
try
:
import
importlib
except
ImportError
:
pass
import
numpy.distutils
# TODO: TensorType should handle this
import
numpy.distutils
# TODO: TensorType should handle this
import
theano
import
theano
...
@@ -38,7 +34,14 @@ from theano.gof.compiledir import gcc_version_str, local_bitwidth
...
@@ -38,7 +34,14 @@ from theano.gof.compiledir import gcc_version_str, local_bitwidth
from
theano.configparser
import
AddConfigVar
,
BoolParam
from
theano.configparser
import
AddConfigVar
,
BoolParam
AddConfigVar
(
'cmodule.mac_framework_link'
,
importlib
=
None
try
:
import
importlib
except
ImportError
:
pass
AddConfigVar
(
'cmodule.mac_framework_link'
,
"If set to True, breaks certain MacOS installations with the infamous "
"If set to True, breaks certain MacOS installations with the infamous "
"Bus Error"
,
"Bus Error"
,
BoolParam
(
False
))
BoolParam
(
False
))
...
@@ -136,7 +139,8 @@ class ExtFunction(object):
...
@@ -136,7 +139,8 @@ class ExtFunction(object):
class
DynamicModule
(
object
):
class
DynamicModule
(
object
):
def
__init__
(
self
,
name
=
None
):
def
__init__
(
self
,
name
=
None
):
assert
name
is
None
,
(
"The 'name' parameter of DynamicModule"
assert
name
is
None
,
(
"The 'name' parameter of DynamicModule"
" cannot be specified anymore. Instead, 'code_hash'"
" cannot be specified anymore. Instead, 'code_hash'"
" will be automatically computed and can be used as"
" will be automatically computed and can be used as"
" the module's name."
)
" the module's name."
)
...
@@ -429,8 +433,8 @@ def get_safe_part(key):
...
@@ -429,8 +433,8 @@ def get_safe_part(key):
# Find the md5 hash part.
# Find the md5 hash part.
c_link_key
=
key
[
1
]
c_link_key
=
key
[
1
]
for
key_element
in
c_link_key
[
1
:]:
for
key_element
in
c_link_key
[
1
:]:
if
(
isinstance
(
key_element
,
string_types
)
if
(
isinstance
(
key_element
,
string_types
)
and
and
key_element
.
startswith
(
'md5:'
)):
key_element
.
startswith
(
'md5:'
)):
md5
=
key_element
[
4
:]
md5
=
key_element
[
4
:]
break
break
...
@@ -1149,15 +1153,14 @@ class ModuleCache(object):
...
@@ -1149,15 +1153,14 @@ class ModuleCache(object):
# This is to make debugging in pdb easier, by providing
# This is to make debugging in pdb easier, by providing
# the offending keys in the local context.
# the offending keys in the local context.
# key_data_keys = list(key_data.keys)
# key_data_keys = list(key_data.keys)
#
#
import pdb; pdb.set_trace()
# import pdb; pdb.set_trace()
pass
pass
elif
found
>
1
:
elif
found
>
1
:
msg
=
'Multiple equal keys found in unpickled KeyData file'
msg
=
'Multiple equal keys found in unpickled KeyData file'
if
msg
:
if
msg
:
raise
AssertionError
(
raise
AssertionError
(
"
%
s. Verify the __eq__ and __hash__ functions of your "
"
%
s. Verify the __eq__ and __hash__ functions of your "
"Ops. The file is:
%
s. The key is:
%
s"
%
"Ops. The file is:
%
s. The key is:
%
s"
%
(
msg
,
key_pkl
,
key
))
(
msg
,
key_pkl
,
key
))
# Also verify that there exists no other loaded key that would be equal
# Also verify that there exists no other loaded key that would be equal
# to this key. In order to speed things up, we only compare to keys
# to this key. In order to speed things up, we only compare to keys
# with the same version part and config md5, since we can assume this
# with the same version part and config md5, since we can assume this
...
@@ -1805,9 +1808,9 @@ class GCC_compiler(Compiler):
...
@@ -1805,9 +1808,9 @@ class GCC_compiler(Compiler):
for
line
in
default_lines
:
for
line
in
default_lines
:
if
line
.
startswith
(
part
[
0
]):
if
line
.
startswith
(
part
[
0
]):
part2
=
[
p
for
p
in
join_options
(
line
.
split
())
part2
=
[
p
for
p
in
join_options
(
line
.
split
())
if
(
not
'march'
in
p
and
if
(
'march'
not
in
p
and
not
'mtune'
in
p
and
'mtune'
not
in
p
and
not
'target-cpu'
in
p
)]
'target-cpu'
not
in
p
)]
new_flags
=
[
p
for
p
in
part
if
p
not
in
part2
]
new_flags
=
[
p
for
p
in
part
if
p
not
in
part2
]
# Replace '-target-cpu value', which is an option
# Replace '-target-cpu value', which is an option
# of clang, with '-march=value', for g++
# of clang, with '-march=value', for g++
...
@@ -2021,13 +2024,12 @@ class GCC_compiler(Compiler):
...
@@ -2021,13 +2024,12 @@ class GCC_compiler(Compiler):
cmd
.
append
(
cppfilename
)
cmd
.
append
(
cppfilename
)
cmd
.
extend
([
'-L
%
s'
%
ldir
for
ldir
in
lib_dirs
])
cmd
.
extend
([
'-L
%
s'
%
ldir
for
ldir
in
lib_dirs
])
cmd
.
extend
([
'-l
%
s'
%
l
for
l
in
libs
])
cmd
.
extend
([
'-l
%
s'
%
l
for
l
in
libs
])
#print >> sys.stderr, 'COMPILING W CMD', cmd
#
print >> sys.stderr, 'COMPILING W CMD', cmd
_logger
.
debug
(
'Running cmd:
%
s'
,
' '
.
join
(
cmd
))
_logger
.
debug
(
'Running cmd:
%
s'
,
' '
.
join
(
cmd
))
def
print_command_line_error
():
def
print_command_line_error
():
# Print command line when a problem occurred.
# Print command line when a problem occurred.
print
((
print
((
"Problem occurred during compilation with the "
"Problem occurred during compilation with the "
"command line below:"
),
file
=
sys
.
stderr
)
"command line below:"
),
file
=
sys
.
stderr
)
print
(
' '
.
join
(
cmd
),
file
=
sys
.
stderr
)
print
(
' '
.
join
(
cmd
),
file
=
sys
.
stderr
)
...
...
theano/tests/test_flake8.py
浏览文件 @
700d883b
...
@@ -244,7 +244,6 @@ whitelist_flake8 = [
...
@@ -244,7 +244,6 @@ whitelist_flake8 = [
"gof/graph.py"
,
"gof/graph.py"
,
"gof/__init__.py"
,
"gof/__init__.py"
,
"gof/op.py"
,
"gof/op.py"
,
"gof/cmodule.py"
,
"gof/tests/test_cmodule.py"
,
"gof/tests/test_cmodule.py"
,
"gof/tests/test_destroyhandler.py"
,
"gof/tests/test_destroyhandler.py"
,
"gof/tests/test_opt.py"
,
"gof/tests/test_opt.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论