Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
843b6249
提交
843b6249
authored
5月 22, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Flake8 for compile/builders.py
上级
5d91204d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
builders.py
theano/compile/builders.py
+10
-9
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/compile/builders.py
浏览文件 @
843b6249
...
@@ -15,7 +15,9 @@ class OpFromGraph(gof.Op):
...
@@ -15,7 +15,9 @@ class OpFromGraph(gof.Op):
TODO:
TODO:
- examples for a multi-layer mlp. where?
- examples for a multi-layer mlp. where?
- __hash__, __eq__ otherwise won't merge, try gof.opt.is_same_graph_with_merge(op1.new_outputs, op2, new_outputs)
- __hash__, __eq__ otherwise won't merge, try
gof.opt.is_same_graph_with_merge(op1.new_outputs, op2,
new_outputs)
- c_code() to remove the double overhead?
- c_code() to remove the double overhead?
- opt to unfold it, work inplace on inputs
- opt to unfold it, work inplace on inputs
- grad() make it support DisconnectedType and the new interface
- grad() make it support DisconnectedType and the new interface
...
@@ -68,7 +70,7 @@ class OpFromGraph(gof.Op):
...
@@ -68,7 +70,7 @@ class OpFromGraph(gof.Op):
for
i
in
inputs
+
outputs
:
for
i
in
inputs
+
outputs
:
if
not
isinstance
(
i
,
gof
.
Variable
):
if
not
isinstance
(
i
,
gof
.
Variable
):
raise
TypeError
(
raise
TypeError
(
'inputs and outputs must be Variable instances'
,
i
)
'inputs and outputs must be Variable instances'
,
i
)
if
'updates'
in
kwargs
:
if
'updates'
in
kwargs
:
raise
TypeError
(
'updates are not allowed in kwargs'
)
raise
TypeError
(
'updates are not allowed in kwargs'
)
...
@@ -76,8 +78,6 @@ class OpFromGraph(gof.Op):
...
@@ -76,8 +78,6 @@ class OpFromGraph(gof.Op):
# not see them. Otherwise their is problem with the gradient.
# not see them. Otherwise their is problem with the gradient.
self
.
shared_inputs
=
[
var
for
var
in
gof
.
graph
.
inputs
(
outputs
)
self
.
shared_inputs
=
[
var
for
var
in
gof
.
graph
.
inputs
(
outputs
)
if
isinstance
(
var
,
SharedVariable
)]
if
isinstance
(
var
,
SharedVariable
)]
used_inputs
=
[
var
for
var
in
gof
.
graph
.
inputs
(
outputs
)
if
not
isinstance
(
var
,
gof
.
Constant
)]
shared_vars
=
[
var
.
type
()
for
var
in
self
.
shared_inputs
]
shared_vars
=
[
var
.
type
()
for
var
in
self
.
shared_inputs
]
new
=
rebuild_collect_shared
(
outputs
,
inputs
=
inputs
+
shared_vars
,
new
=
rebuild_collect_shared
(
outputs
,
inputs
=
inputs
+
shared_vars
,
replace
=
dict
(
zip
(
self
.
shared_inputs
,
replace
=
dict
(
zip
(
self
.
shared_inputs
,
...
@@ -110,8 +110,8 @@ class OpFromGraph(gof.Op):
...
@@ -110,8 +110,8 @@ class OpFromGraph(gof.Op):
def
make_node
(
self
,
*
inputs
):
def
make_node
(
self
,
*
inputs
):
for
input
,
type
in
zip
(
inputs
,
self
.
input_types
):
for
input
,
type
in
zip
(
inputs
,
self
.
input_types
):
if
not
type
==
input
.
type
:
if
not
type
==
input
.
type
:
raise
TypeError
(
"Wrong type, expected
%
s but got
%
s"
raise
TypeError
(
"Wrong type, expected
%
s but got
%
s"
%
%
(
type
,
input
.
type
))
(
type
,
input
.
type
))
return
gof
.
Apply
(
self
,
return
gof
.
Apply
(
self
,
list
(
inputs
)
+
self
.
shared_inputs
,
list
(
inputs
)
+
self
.
shared_inputs
,
[
type
()
for
type
in
self
.
output_types
])
[
type
()
for
type
in
self
.
output_types
])
...
@@ -143,9 +143,10 @@ class OpFromGraph(gof.Op):
...
@@ -143,9 +143,10 @@ class OpFromGraph(gof.Op):
grad_ops
=
self
.
grad_ops
grad_ops
=
self
.
grad_ops
else
:
else
:
gs
=
theano
.
gradient
.
grad
(
cost
=
None
,
gs
=
theano
.
gradient
.
grad
(
cost
=
None
,
known_grads
=
dict
(
zip
(
self
.
new_outputs
,
output_grads
)),
known_grads
=
dict
(
zip
(
self
.
new_outputs
,
wrt
=
self
.
new_inputs
,
output_grads
)),
disconnected_inputs
=
'ignore'
)
wrt
=
self
.
new_inputs
,
disconnected_inputs
=
'ignore'
)
grad_ops
=
[]
grad_ops
=
[]
for
g
in
gs
:
for
g
in
gs
:
...
...
theano/tests/test_flake8.py
浏览文件 @
843b6249
...
@@ -38,7 +38,6 @@ whitelist_flake8 = [
...
@@ -38,7 +38,6 @@ whitelist_flake8 = [
"tests/test_tutorial.py"
,
"tests/test_tutorial.py"
,
"tests/disturb_mem.py"
,
"tests/disturb_mem.py"
,
"tests/unittest_tools.py"
,
"tests/unittest_tools.py"
,
"compile/builders.py"
,
"compile/__init__.py"
,
"compile/__init__.py"
,
"compile/profiling.py"
,
"compile/profiling.py"
,
"compile/function_module.py"
,
"compile/function_module.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论