Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3ebd725a
提交
3ebd725a
authored
7月 10, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flake8 of theano/gof/link.py
上级
8c4e330d
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
13 行删除
+14
-13
link.py
theano/gof/link.py
+14
-12
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/gof/link.py
浏览文件 @
3ebd725a
...
@@ -7,14 +7,14 @@ import traceback
...
@@ -7,14 +7,14 @@ import traceback
import
numpy
import
numpy
import
theano
import
theano
from
theano.compat
import
PY3
,
izip
from
theano.compat
import
izip
from
six
import
reraise
from
six
import
reraise
from
six.moves
import
StringIO
from
six.moves
import
StringIO
from
theano.gof
import
utils
from
theano.gof
import
utils
from
theano.gof
import
graph
from
theano.gof
import
graph
from
theano.gof.type
import
Type
from
theano.gof.type
import
Type
from
.utils
import
MethodNotDefined
,
undef
from
.utils
import
undef
__excepthook
=
sys
.
excepthook
__excepthook
=
sys
.
excepthook
...
@@ -281,9 +281,9 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None):
...
@@ -281,9 +281,9 @@ def raise_with_op(node, thunk=None, exc_info=None, storage_map=None):
else
:
else
:
detailed_err_msg
+=
"
\n
"
detailed_err_msg
+=
"
\n
"
detailed_err_msg
+=
" TotalSize:
%
s Byte(s)
%.3
f GB
\n
"
%
(
detailed_err_msg
+=
" TotalSize:
%
s Byte(s)
%.3
f GB
\n
"
%
(
total_size
,
total_size
/
1024.
/
1024
/
1024
)
total_size
,
total_size
/
1024.
/
1024
/
1024
)
detailed_err_msg
+=
" TotalSize inputs:
%
s Byte(s)
%.3
f BG
\n
"
%
(
detailed_err_msg
+=
" TotalSize inputs:
%
s Byte(s)
%.3
f BG
\n
"
%
(
total_size_inputs
,
total_size_inputs
/
1024.
/
1024
/
1024
)
total_size_inputs
,
total_size_inputs
/
1024.
/
1024
/
1024
)
else
:
else
:
hints
.
append
(
hints
.
append
(
...
@@ -326,7 +326,7 @@ class Linker(object):
...
@@ -326,7 +326,7 @@ class Linker(object):
raise
utils
.
MethodNotDefined
(
"make_thunk"
,
type
(
self
),
raise
utils
.
MethodNotDefined
(
"make_thunk"
,
type
(
self
),
self
.
__class__
.
__name__
)
self
.
__class__
.
__name__
)
#
# DELETEME #
#
#
DELETEME
#
def
make_function
(
self
,
unpack_single
=
True
,
**
kwargs
):
def
make_function
(
self
,
unpack_single
=
True
,
**
kwargs
):
"""
"""
Returns a function that takes values corresponding to the inputs of the
Returns a function that takes values corresponding to the inputs of the
...
@@ -350,8 +350,8 @@ class Linker(object):
...
@@ -350,8 +350,8 @@ class Linker(object):
def
execute
(
*
args
):
def
execute
(
*
args
):
def
e_arity
(
takes
,
got
):
def
e_arity
(
takes
,
got
):
return
'Function call takes exactly
%
i
%
s (
%
i given)'
\
return
'Function call takes exactly
%
i
%
s (
%
i given)'
%
(
%
(
takes
,
[
'argument'
,
'arguments'
][
takes
>
1
],
got
)
takes
,
[
'argument'
,
'arguments'
][
takes
>
1
],
got
)
if
(
len
(
args
)
!=
len
(
inputs
)):
if
(
len
(
args
)
!=
len
(
inputs
)):
raise
TypeError
(
e_arity
(
len
(
inputs
),
len
(
args
)))
raise
TypeError
(
e_arity
(
len
(
inputs
),
len
(
args
)))
for
arg
,
variable
in
izip
(
args
,
inputs
):
for
arg
,
variable
in
izip
(
args
,
inputs
):
...
@@ -394,7 +394,7 @@ class Container(object):
...
@@ -394,7 +394,7 @@ class Container(object):
"""
"""
if
not
isinstance
(
storage
,
list
)
or
not
len
(
storage
)
>=
1
:
if
not
isinstance
(
storage
,
list
)
or
not
len
(
storage
)
>=
1
:
raise
TypeError
(
"storage must be a list of length at least one"
)
raise
TypeError
(
"storage must be a list of length at least one"
)
#self.r = r
#
self.r = r
if
isinstance
(
r
,
Type
):
if
isinstance
(
r
,
Type
):
self
.
type
=
r
self
.
type
=
r
else
:
else
:
...
@@ -459,7 +459,6 @@ class Container(object):
...
@@ -459,7 +459,6 @@ class Container(object):
# don't return an ndarray.
# don't return an ndarray.
if
(
r
.
storage
[
0
]
is
not
None
and
if
(
r
.
storage
[
0
]
is
not
None
and
not
self
.
type
.
is_valid_value
(
r
.
storage
[
0
])):
not
self
.
type
.
is_valid_value
(
r
.
storage
[
0
])):
assert
not
data_was_in_memo
assert
not
data_was_in_memo
assert
self
.
type
.
is_valid_value
(
self
.
storage
[
0
])
assert
self
.
type
.
is_valid_value
(
self
.
storage
[
0
])
# This should also work for read only container.
# This should also work for read only container.
...
@@ -672,7 +671,7 @@ class PerformLinker(LocalLinker):
...
@@ -672,7 +671,7 @@ class PerformLinker(LocalLinker):
no_recycling
=
[]
no_recycling
=
[]
if
self
.
fgraph
is
not
None
and
self
.
fgraph
is
not
fgraph
:
if
self
.
fgraph
is
not
None
and
self
.
fgraph
is
not
fgraph
:
return
type
(
self
)(
allow_gc
=
self
.
allow_gc
)
.
accept
(
fgraph
,
no_recycling
)
return
type
(
self
)(
allow_gc
=
self
.
allow_gc
)
.
accept
(
fgraph
,
no_recycling
)
#raise Exception("Cannot accept from a Linker that is already tied to another FunctionGraph.")
#
raise Exception("Cannot accept from a Linker that is already tied to another FunctionGraph.")
self
.
fgraph
=
fgraph
self
.
fgraph
=
fgraph
self
.
no_recycling
=
no_recycling
self
.
no_recycling
=
no_recycling
return
self
return
self
...
@@ -721,9 +720,12 @@ class PerformLinker(LocalLinker):
...
@@ -721,9 +720,12 @@ class PerformLinker(LocalLinker):
for
node
in
order
:
for
node
in
order
:
if
self
.
allow_gc
:
if
self
.
allow_gc
:
post_thunk_old_storage
.
append
([
storage_map
[
input
]
post_thunk_old_storage
.
append
(
[
storage_map
[
input
]
for
input
in
node
.
inputs
for
input
in
node
.
inputs
if
(
input
in
computed
)
and
(
input
not
in
fgraph
.
outputs
)
and
node
==
last_user
[
input
]])
if
(
input
in
computed
)
and
(
input
not
in
fgraph
.
outputs
)
and
(
node
==
last_user
[
input
])])
if
no_recycling
is
True
:
if
no_recycling
is
True
:
# True seems like some special code for *everything*?? -JB
# True seems like some special code for *everything*?? -JB
...
...
theano/tests/test_flake8.py
浏览文件 @
3ebd725a
...
@@ -243,7 +243,6 @@ whitelist_flake8 = [
...
@@ -243,7 +243,6 @@ whitelist_flake8 = [
"gof/unify.py"
,
"gof/unify.py"
,
"gof/graph.py"
,
"gof/graph.py"
,
"gof/__init__.py"
,
"gof/__init__.py"
,
"gof/link.py"
,
"gof/fg.py"
,
"gof/fg.py"
,
"gof/op.py"
,
"gof/op.py"
,
"gof/cmodule.py"
,
"gof/cmodule.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论