Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a02bc80d
提交
a02bc80d
authored
4月 01, 2013
作者:
abalkin
提交者:
Alexander Belopolsky
6月 04, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1281: Convert to unicode early under Python 3.x. Thanks @delallea for the suggestion.
上级
2d2a8f9f
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
8 行删除
+19
-8
__init__.py
theano/compat/__init__.py
+11
-0
cmodule.py
theano/gof/cmodule.py
+8
-8
没有找到文件。
theano/compat/__init__.py
浏览文件 @
a02bc80d
...
@@ -30,7 +30,12 @@ if PY3:
...
@@ -30,7 +30,12 @@ if PY3:
from
itertools
import
combinations
,
product
from
itertools
import
combinations
,
product
from
sys
import
maxsize
from
sys
import
maxsize
def
decode
(
x
):
return
x
.
decode
()
def
decode_iter
(
itr
):
for
x
in
itr
:
yield
x
.
decode
()
else
:
else
:
from
operator
import
div
as
operator_div
from
operator
import
div
as
operator_div
...
@@ -44,3 +49,9 @@ else:
...
@@ -44,3 +49,9 @@ else:
from
theano.compat.python2x
import
all
,
any
,
partial
,
defaultdict
,
deque
from
theano.compat.python2x
import
all
,
any
,
partial
,
defaultdict
,
deque
from
theano.compat.python2x
import
combinations
,
product
,
maxsize
from
theano.compat.python2x
import
combinations
,
product
,
maxsize
from
theano.compat.python2x
import
DictMixin
,
OrderedDict
from
theano.compat.python2x
import
DictMixin
,
OrderedDict
def
decode
(
x
):
return
x
def
decode_iter
(
x
):
return
x
theano/gof/cmodule.py
浏览文件 @
a02bc80d
...
@@ -19,7 +19,7 @@ import distutils.sysconfig
...
@@ -19,7 +19,7 @@ import distutils.sysconfig
import
numpy.distutils
# TODO: TensorType should handle this
import
numpy.distutils
# TODO: TensorType should handle this
import
theano
import
theano
from
theano.compat
import
PY3
,
b
,
next
from
theano.compat
import
PY3
,
next
,
decode
,
decode_iter
from
theano.gof.utils
import
flatten
from
theano.gof.utils
import
flatten
from
theano.configparser
import
config
from
theano.configparser
import
config
from
theano.gof.cc
import
hash_from_code
from
theano.gof.cc
import
hash_from_code
...
@@ -1543,16 +1543,16 @@ class GCC_compiler(object):
...
@@ -1543,16 +1543,16 @@ class GCC_compiler(object):
if
p
.
returncode
!=
0
:
if
p
.
returncode
!=
0
:
return
None
return
None
stdout
=
p
.
stdout
.
readlines
(
)
stdout
=
decode_iter
(
p
.
stdout
.
readlines
()
)
stderr
=
p
.
stderr
.
readlines
(
)
stderr
=
decode_iter
(
p
.
stderr
.
readlines
()
)
lines
=
[]
lines
=
[]
if
parse
:
if
parse
:
for
line
in
stdout
+
stderr
:
for
line
in
stdout
+
stderr
:
if
b
(
"COLLECT_GCC_OPTIONS="
)
in
line
:
if
"COLLECT_GCC_OPTIONS="
in
line
:
continue
continue
elif
b
(
"-march="
)
in
line
and
b
(
"-march=native"
)
not
in
line
:
elif
"-march="
in
line
and
"-march=native"
not
in
line
:
lines
.
append
(
line
.
strip
())
lines
.
append
(
line
.
strip
())
elif
b
(
"-mtune="
)
in
line
and
b
(
"-march=native"
)
not
in
line
:
elif
"-mtune="
in
line
and
"-march=native"
not
in
line
:
lines
.
append
(
line
.
strip
())
lines
.
append
(
line
.
strip
())
lines
=
list
(
set
(
lines
))
# to remove duplicate
lines
=
list
(
set
(
lines
))
# to remove duplicate
else
:
else
:
...
@@ -1835,7 +1835,7 @@ class GCC_compiler(object):
...
@@ -1835,7 +1835,7 @@ class GCC_compiler(object):
try
:
try
:
p
=
call_subprocess_Popen
(
cmd
,
stderr
=
subprocess
.
PIPE
)
p
=
call_subprocess_Popen
(
cmd
,
stderr
=
subprocess
.
PIPE
)
compile_stderr
=
p
.
communicate
()[
1
]
compile_stderr
=
decode
(
p
.
communicate
()[
1
])
except
Exception
:
except
Exception
:
# An exception can occur e.g. if `g++` is not found.
# An exception can occur e.g. if `g++` is not found.
print_command_line_error
()
print_command_line_error
()
...
@@ -1856,7 +1856,7 @@ class GCC_compiler(object):
...
@@ -1856,7 +1856,7 @@ class GCC_compiler(object):
# prints the exception, having '\n' in the text makes it more
# prints the exception, having '\n' in the text makes it more
# difficult to read.
# difficult to read.
raise
Exception
(
'Compilation failed (return status=
%
s):
%
s'
%
raise
Exception
(
'Compilation failed (return status=
%
s):
%
s'
%
(
status
,
compile_stderr
.
replace
(
b
(
'
\n
'
),
b
(
'. '
)
)))
(
status
,
compile_stderr
.
replace
(
'
\n
'
,
'. '
)))
elif
config
.
cmodule
.
compilation_warning
and
compile_stderr
:
elif
config
.
cmodule
.
compilation_warning
and
compile_stderr
:
# Print errors just below the command line.
# Print errors just below the command line.
print
compile_stderr
print
compile_stderr
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论