Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
626104a8
提交
626104a8
authored
4月 15, 2015
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2744 from mohammadpz/pep8
Pep8
上级
d99cb9df
24a8dc48
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
31 行增加
和
33 行删除
+31
-33
configdefaults.py
theano/configdefaults.py
+0
-0
configparser.py
theano/configparser.py
+4
-3
gradient.py
theano/gradient.py
+0
-0
ifelse.py
theano/ifelse.py
+20
-20
test_flake8.py
theano/tests/test_flake8.py
+0
-5
updates.py
theano/updates.py
+7
-5
没有找到文件。
theano/configdefaults.py
浏览文件 @
626104a8
差异被折叠。
点击展开。
theano/configparser.py
浏览文件 @
626104a8
...
@@ -217,8 +217,8 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
...
@@ -217,8 +217,8 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
_i_am_a_config_class
=
True
_i_am_a_config_class
=
True
setattr
(
root
.
__class__
,
sections
[
0
],
SubObj
())
setattr
(
root
.
__class__
,
sections
[
0
],
SubObj
())
newroot
=
getattr
(
root
,
sections
[
0
])
newroot
=
getattr
(
root
,
sections
[
0
])
if
(
not
getattr
(
newroot
,
'_i_am_a_config_class'
,
False
)
if
(
not
getattr
(
newroot
,
'_i_am_a_config_class'
,
False
)
or
or
isinstance
(
newroot
,
type
)):
isinstance
(
newroot
,
type
)):
raise
TypeError
(
raise
TypeError
(
'Internal config nodes must be config class instances'
,
'Internal config nodes must be config class instances'
,
newroot
)
newroot
)
...
@@ -235,7 +235,8 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
...
@@ -235,7 +235,8 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
if
not
callable
(
configparam
.
default
):
if
not
callable
(
configparam
.
default
):
configparam
.
__get__
()
configparam
.
__get__
()
else
:
else
:
# We do not want to evaluate now the default value when it is a callable.
# We do not want to evaluate now the default value
# when it is a callable.
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.
...
...
theano/gradient.py
浏览文件 @
626104a8
差异被折叠。
点击展开。
theano/ifelse.py
浏览文件 @
626104a8
...
@@ -10,15 +10,6 @@ which value to report. Note also that `switch` is an elemwise operation (so
...
@@ -10,15 +10,6 @@ which value to report. Note also that `switch` is an elemwise operation (so
it picks each entry of a matrix according to the condition) while `ifelse`
it picks each entry of a matrix according to the condition) while `ifelse`
is a global operation with a scalar condition.
is a global operation with a scalar condition.
"""
"""
__docformat__
=
'restructedtext en'
__authors__
=
(
"Razvan Pascanu "
"James Bergstra "
"Dumitru Erhan "
"David Warde-Farley"
)
__copyright__
=
"(c) 2010, Universite de Montreal"
__contact__
=
"Razvan Pascanu <r.pascanu@gmail>"
from
copy
import
deepcopy
from
copy
import
deepcopy
from
itertools
import
izip
from
itertools
import
izip
import
logging
import
logging
...
@@ -34,6 +25,15 @@ from theano.tensor import opt
...
@@ -34,6 +25,15 @@ from theano.tensor import opt
from
theano.scan_module.scan_utils
import
find_up
from
theano.scan_module.scan_utils
import
find_up
from
theano.scan_module.scan_utils
import
clone
from
theano.scan_module.scan_utils
import
clone
__docformat__
=
'restructedtext en'
__authors__
=
(
"Razvan Pascanu "
"James Bergstra "
"Dumitru Erhan "
"David Warde-Farley"
)
__copyright__
=
"(c) 2010, Universite de Montreal"
__contact__
=
"Razvan Pascanu <r.pascanu@gmail>"
_logger
=
logging
.
getLogger
(
'theano.ifelse'
)
_logger
=
logging
.
getLogger
(
'theano.ifelse'
)
...
@@ -338,13 +338,13 @@ def ifelse(condition, then_branch, else_branch, name=None):
...
@@ -338,13 +338,13 @@ def ifelse(condition, then_branch, else_branch, name=None):
# converted into one, then we try to do that.
# converted into one, then we try to do that.
# This case happens when one of the elements has a GPU type,
# This case happens when one of the elements has a GPU type,
# for instance a shared variable that was silently moved to GPU.
# for instance a shared variable that was silently moved to GPU.
if
(
isinstance
(
then_branch_elem
.
type
,
TensorType
)
if
(
isinstance
(
then_branch_elem
.
type
,
TensorType
)
and
not
and
not
isinstance
(
else_branch_elem
.
type
,
TensorType
)):
isinstance
(
else_branch_elem
.
type
,
TensorType
)):
else_branch_elem
=
then_branch_elem
.
type
.
filter_variable
(
else_branch_elem
=
then_branch_elem
.
type
.
filter_variable
(
else_branch_elem
)
else_branch_elem
)
elif
(
isinstance
(
else_branch_elem
.
type
,
TensorType
)
elif
(
isinstance
(
else_branch_elem
.
type
,
TensorType
)
and
not
and
not
isinstance
(
then_branch_elem
.
type
,
TensorType
)):
isinstance
(
then_branch_elem
.
type
,
TensorType
)):
then_branch_elem
=
else_branch_elem
.
type
.
filter_variable
(
then_branch_elem
=
else_branch_elem
.
type
.
filter_variable
(
then_branch_elem
)
then_branch_elem
)
...
@@ -471,7 +471,7 @@ def ifelse_lift_single_if_through_acceptable_ops(main_node):
...
@@ -471,7 +471,7 @@ def ifelse_lift_single_if_through_acceptable_ops(main_node):
ts
=
node
.
inputs
[
1
:][:
op
.
n_outs
]
ts
=
node
.
inputs
[
1
:][:
op
.
n_outs
]
fs
=
node
.
inputs
[
1
:][
op
.
n_outs
:]
fs
=
node
.
inputs
[
1
:][
op
.
n_outs
:]
outs
=
main_node
.
outputs
#
outs = main_node.outputs
mop
=
main_node
.
op
mop
=
main_node
.
op
true_ins
=
[]
true_ins
=
[]
false_ins
=
[]
false_ins
=
[]
...
@@ -486,8 +486,8 @@ def ifelse_lift_single_if_through_acceptable_ops(main_node):
...
@@ -486,8 +486,8 @@ def ifelse_lift_single_if_through_acceptable_ops(main_node):
false_ins
.
append
(
x
)
false_ins
.
append
(
x
)
true_eval
=
mop
(
*
true_ins
,
**
dict
(
return_list
=
True
))
true_eval
=
mop
(
*
true_ins
,
**
dict
(
return_list
=
True
))
false_eval
=
mop
(
*
false_ins
,
**
dict
(
return_list
=
True
))
false_eval
=
mop
(
*
false_ins
,
**
dict
(
return_list
=
True
))
#true_eval = clone(outs, replace = dict(zip(node.outputs, ts)))
#
true_eval = clone(outs, replace = dict(zip(node.outputs, ts)))
#false_eval = clone(outs, replace = dict(zip(node.outputs, fs)))
#
false_eval = clone(outs, replace = dict(zip(node.outputs, fs)))
nw_outs
=
ifelse
(
node
.
inputs
[
0
],
true_eval
,
false_eval
,
return_list
=
True
)
nw_outs
=
ifelse
(
node
.
inputs
[
0
],
true_eval
,
false_eval
,
return_list
=
True
)
return
nw_outs
return
nw_outs
...
@@ -567,8 +567,8 @@ class CondMerge(gof.Optimizer):
...
@@ -567,8 +567,8 @@ class CondMerge(gof.Optimizer):
if
merging_node
.
op
.
name
:
if
merging_node
.
op
.
name
:
mn_name
=
merging_node
.
op
.
name
mn_name
=
merging_node
.
op
.
name
pl_name
=
'?'
pl_name
=
'?'
mn_n_ts
=
len
(
mn_ts
)
#
mn_n_ts = len(mn_ts)
mn_n_fs
=
len
(
mn_fs
)
#
mn_n_fs = len(mn_fs)
if
proposal
.
op
.
name
:
if
proposal
.
op
.
name
:
pl_name
=
proposal
.
op
.
name
pl_name
=
proposal
.
op
.
name
new_ifelse
=
IfElse
(
new_ifelse
=
IfElse
(
...
@@ -673,8 +673,8 @@ def cond_merge_random_op(main_node):
...
@@ -673,8 +673,8 @@ def cond_merge_random_op(main_node):
if
merging_node
.
op
.
name
:
if
merging_node
.
op
.
name
:
mn_name
=
merging_node
.
op
.
name
mn_name
=
merging_node
.
op
.
name
pl_name
=
'?'
pl_name
=
'?'
mn_n_ts
=
len
(
mn_ts
)
#
mn_n_ts = len(mn_ts)
mn_n_fs
=
len
(
mn_fs
)
#
mn_n_fs = len(mn_fs)
if
proposal
.
op
.
name
:
if
proposal
.
op
.
name
:
pl_name
=
proposal
.
op
.
name
pl_name
=
proposal
.
op
.
name
new_ifelse
=
IfElse
(
new_ifelse
=
IfElse
(
...
...
theano/tests/test_flake8.py
浏览文件 @
626104a8
...
@@ -17,13 +17,8 @@ except ImportError:
...
@@ -17,13 +17,8 @@ except ImportError:
flake8_available
=
False
flake8_available
=
False
whitelist_flake8
=
[
whitelist_flake8
=
[
"updates.py"
,
"__init__.py"
,
"__init__.py"
,
"configparser.py"
,
"ifelse.py"
,
"version.py"
,
"version.py"
,
"configdefaults.py"
,
"gradient.py"
,
"compat/python2x.py"
,
"compat/python2x.py"
,
"compat/six.py"
,
"compat/six.py"
,
"compat/__init__.py"
,
"compat/__init__.py"
,
...
...
theano/updates.py
浏览文件 @
626104a8
"""Defines Updates object for storing a (SharedVariable, new_value) mapping.
"""Defines Updates object for storing a (SharedVariable, new_value) mapping.
"""
"""
from
theano.compat.python2x
import
OrderedDict
from
theano.compile.sharedvalue
import
SharedVariable
import
logging
import
warnings
__authors__
=
"theano-dev"
__authors__
=
"theano-dev"
__copyright__
=
"(c) 2010, Universite de Montreal"
__copyright__
=
"(c) 2010, Universite de Montreal"
__license__
=
"3-clause BSD License"
__license__
=
"3-clause BSD License"
...
@@ -8,12 +15,7 @@ __contact__ = "theano-dev <theano-dev@googlegroups.com>"
...
@@ -8,12 +15,7 @@ __contact__ = "theano-dev <theano-dev@googlegroups.com>"
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
from
theano.compat.python2x
import
OrderedDict
from
theano.compile.sharedvalue
import
SharedVariable
import
logging
logger
=
logging
.
getLogger
(
'theano.updates'
)
logger
=
logging
.
getLogger
(
'theano.updates'
)
import
warnings
# Must be an OrderedDict or updates will be applied in a non-deterministic
# Must be an OrderedDict or updates will be applied in a non-deterministic
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论