Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0f86ecd9
提交
0f86ecd9
authored
2月 06, 2012
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #424 from delallea/minor
Minor stuff (PEP8 and typos mostly)
上级
5c576b65
7b5f3adf
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
17 行增加
和
17 行删除
+17
-17
io.py
theano/compile/io.py
+5
-5
pfunc.py
theano/compile/pfunc.py
+0
-0
compiledir.py
theano/gof/compiledir.py
+12
-12
没有找到文件。
theano/compile/io.py
浏览文件 @
0f86ecd9
...
@@ -5,7 +5,8 @@ from theano import gof
...
@@ -5,7 +5,8 @@ from theano import gof
from
sharedvalue
import
SharedVariable
from
sharedvalue
import
SharedVariable
import
logging
import
logging
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
_logger
=
logging
.
getLogger
(
"theano.compile.io"
)
class
SymbolicInput
(
object
):
class
SymbolicInput
(
object
):
"""
"""
...
@@ -49,7 +50,7 @@ class SymbolicInput(object):
...
@@ -49,7 +50,7 @@ class SymbolicInput(object):
def
__init__
(
self
,
variable
,
name
=
None
,
update
=
None
,
mutable
=
None
,
def
__init__
(
self
,
variable
,
name
=
None
,
update
=
None
,
mutable
=
None
,
strict
=
False
,
allow_downcast
=
None
,
autoname
=
True
,
strict
=
False
,
allow_downcast
=
None
,
autoname
=
True
,
implicit
=
False
):
implicit
=
False
):
assert
implicit
is
not
None
# Safety check.
assert
implicit
is
not
None
# Safety check.
self
.
variable
=
variable
self
.
variable
=
variable
if
(
autoname
and
name
is
None
):
if
(
autoname
and
name
is
None
):
self
.
name
=
variable
.
name
self
.
name
=
variable
.
name
...
@@ -194,8 +195,7 @@ class In(SymbolicInput):
...
@@ -194,8 +195,7 @@ class In(SymbolicInput):
# try to keep it synchronized.
# try to keep it synchronized.
def
__init__
(
self
,
variable
,
name
=
None
,
value
=
None
,
update
=
None
,
def
__init__
(
self
,
variable
,
name
=
None
,
value
=
None
,
update
=
None
,
mutable
=
None
,
strict
=
False
,
allow_downcast
=
None
,
autoname
=
True
,
mutable
=
None
,
strict
=
False
,
allow_downcast
=
None
,
autoname
=
True
,
implicit
=
None
,
borrow
=
None
,
shared
=
False
):
implicit
=
None
,
borrow
=
None
,
shared
=
False
):
#if shared, an input's value comes from its persistent storage, not from a default stored
#if shared, an input's value comes from its persistent storage, not from a default stored
#in the function or from the caller
#in the function or from the caller
...
@@ -206,7 +206,7 @@ class In(SymbolicInput):
...
@@ -206,7 +206,7 @@ class In(SymbolicInput):
# mutable=True should require borrow=True. Raise warning when borrow is explicitely set
# mutable=True should require borrow=True. Raise warning when borrow is explicitely set
# to False with mutable=True.
# to False with mutable=True.
if
mutable
:
if
mutable
:
if
borrow
==
False
:
if
borrow
==
False
:
_logger
.
warning
(
"Symbolic input for variable
%
s (name=
%
s) has "
_logger
.
warning
(
"Symbolic input for variable
%
s (name=
%
s) has "
"flags mutable=True, borrow=False. This combination is "
"flags mutable=True, borrow=False. This combination is "
"incompatible since mutable=True implies that the "
"incompatible since mutable=True implies that the "
...
...
theano/compile/pfunc.py
浏览文件 @
0f86ecd9
差异被折叠。
点击展开。
theano/gof/compiledir.py
浏览文件 @
0f86ecd9
...
@@ -15,7 +15,8 @@ compiledir_format_dict = {"platform": platform.platform(),
...
@@ -15,7 +15,8 @@ compiledir_format_dict = {"platform": platform.platform(),
"theano_version"
:
theano
.
__version__
,
"theano_version"
:
theano
.
__version__
,
}
}
compiledir_format_keys
=
", "
.
join
(
compiledir_format_dict
.
keys
())
compiledir_format_keys
=
", "
.
join
(
compiledir_format_dict
.
keys
())
default_compiledir_format
=
"compiledir_
%(platform)
s-
%(processor)
s-
%(python_version)
s"
default_compiledir_format
=
\
"compiledir_
%(platform)
s-
%(processor)
s-
%(python_version)
s"
AddConfigVar
(
"compiledir_format"
,
AddConfigVar
(
"compiledir_format"
,
textwrap
.
fill
(
textwrap
.
dedent
(
"""
\
textwrap
.
fill
(
textwrap
.
dedent
(
"""
\
...
@@ -53,7 +54,7 @@ def filter_compiledir(path):
...
@@ -53,7 +54,7 @@ def filter_compiledir(path):
# the same directory at the same time.
# the same directory at the same time.
if
e
.
errno
!=
errno
.
EEXIST
:
if
e
.
errno
!=
errno
.
EEXIST
:
raise
ValueError
(
raise
ValueError
(
"Unable to create t
o create t
he compiledir directory"
"Unable to create the compiledir directory"
" '
%
s'. Check the permissions."
%
path
)
" '
%
s'. Check the permissions."
%
path
)
# PROBLEM: sometimes the initial approach based on
# PROBLEM: sometimes the initial approach based on
...
@@ -118,7 +119,7 @@ def print_compiledir_content():
...
@@ -118,7 +119,7 @@ def print_compiledir_content():
compiledir
=
theano
.
config
.
compiledir
compiledir
=
theano
.
config
.
compiledir
table
=
[]
table
=
[]
more_th
e
n_one_ops
=
0
more_th
a
n_one_ops
=
0
zeros_op
=
0
zeros_op
=
0
for
dir
in
os
.
listdir
(
compiledir
):
for
dir
in
os
.
listdir
(
compiledir
):
file
=
None
file
=
None
...
@@ -131,7 +132,7 @@ def print_compiledir_content():
...
@@ -131,7 +132,7 @@ def print_compiledir_content():
if
len
(
ops
)
==
0
:
if
len
(
ops
)
==
0
:
zeros_op
+=
1
zeros_op
+=
1
elif
len
(
ops
)
>
1
:
elif
len
(
ops
)
>
1
:
more_th
e
n_one_ops
+=
1
more_th
a
n_one_ops
+=
1
else
:
else
:
types
=
list
(
set
([
x
for
x
in
flatten
(
keydata
.
keys
)
types
=
list
(
set
([
x
for
x
in
flatten
(
keydata
.
keys
)
if
isinstance
(
x
,
theano
.
gof
.
Type
)]))
if
isinstance
(
x
,
theano
.
gof
.
Type
)]))
...
@@ -142,7 +143,7 @@ def print_compiledir_content():
...
@@ -142,7 +143,7 @@ def print_compiledir_content():
if
file
is
not
None
:
if
file
is
not
None
:
file
.
close
()
file
.
close
()
print
"List
%
d compiled individual op
in this theano cache
%
s:"
%
(
print
"List
of
%
d compiled individual ops
in this theano cache
%
s:"
%
(
len
(
table
),
compiledir
)
len
(
table
),
compiledir
)
print
"sub directory/Op/a set of the different associated Theano type"
print
"sub directory/Op/a set of the different associated Theano type"
table
=
sorted
(
table
,
key
=
lambda
t
:
str
(
t
[
1
]))
table
=
sorted
(
table
,
key
=
lambda
t
:
str
(
t
[
1
]))
...
@@ -153,13 +154,12 @@ def print_compiledir_content():
...
@@ -153,13 +154,12 @@ def print_compiledir_content():
table_op_class
[
op
.
__class__
]
+=
1
table_op_class
[
op
.
__class__
]
+=
1
print
print
print
"List
%
d of individual compiled Op class and"
%
(
len
(
table_op_class
)),
print
(
"List of
%
d individual compiled Op classes and "
print
" the number of time it got compiled"
"the number of times they got compiled"
%
len
(
table_op_class
))
table_op_class
=
sorted
(
table_op_class
.
iteritems
(),
key
=
lambda
t
:
t
[
1
])
table_op_class
=
sorted
(
table_op_class
.
iteritems
(),
key
=
lambda
t
:
t
[
1
])
for
op_class
,
nb
in
table_op_class
:
for
op_class
,
nb
in
table_op_class
:
print
op_class
,
nb
print
op_class
,
nb
print
(
"Skipped
%
d files that contained more then"
print
(
"Skipped
%
d files that contained more than"
" 1 op (was compiled with the c linker)"
%
(
more_then_one_ops
))
" 1 op (was compiled with the C linker)"
%
more_than_one_ops
)
print
(
"Skipped
%
d files that contained 0 op"
print
(
"Skipped
%
d files that contained 0 op "
"(Are they always theano.scalar ops?)"
%
(
"(are they always theano.scalar ops?)"
%
zeros_op
)
more_then_one_ops
))
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论