Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d70c1cc6
提交
d70c1cc6
authored
1月 03, 2021
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
1月 09, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename theano.gof.graph.variables to vars_between
上级
6a57a3a0
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
16 行增加
和
18 行删除
+16
-18
test_graph.py
tests/gof/test_graph.py
+2
-2
types.py
theano/compile/function/types.py
+2
-2
fg.py
theano/gof/fg.py
+2
-3
graph.py
theano/gof/graph.py
+3
-3
toolbox.py
theano/gof/toolbox.py
+2
-2
basic.py
theano/link/c/basic.py
+2
-3
bn.py
theano/tensor/nnet/bn.py
+3
-3
没有找到文件。
tests/gof/test_graph.py
浏览文件 @
d70c1cc6
...
...
@@ -19,7 +19,7 @@ from theano.gof.graph import (
is_in_ancestors
,
list_of_nodes
,
orphans
,
var
iables
,
var
s_between
,
walk
,
)
from
theano.gof.op
import
Op
...
...
@@ -405,7 +405,7 @@ def test_variables_and_orphans():
o2
=
MyOp
(
r3
,
o1
)
o2
.
name
=
"o2"
vars_res
=
var
iables
([
r1
,
r2
],
[
o2
])
vars_res
=
var
s_between
([
r1
,
r2
],
[
o2
])
orphans_res
=
orphans
([
r1
,
r2
],
[
o2
])
vars_res_list
=
list
(
vars_res
)
...
...
theano/compile/function/types.py
浏览文件 @
d70c1cc6
...
...
@@ -1444,7 +1444,7 @@ class FunctionMaker:
):
print
(
"loop through outputs node for both graphs"
)
graph_old
.
variables
=
set
(
gof
.
graph
.
var
iables
(
graph_old
.
inputs
,
graph_old
.
outputs
)
gof
.
graph
.
var
s_between
(
graph_old
.
inputs
,
graph_old
.
outputs
)
)
# using clone allowed to avoid a lot of errors
...
...
@@ -1489,7 +1489,7 @@ class FunctionMaker:
# this is a brand new graph, optimize it, save it to graph_db
print
(
"graph not found in graph_db, optimizing the graph"
)
self
.
fgraph
.
variables
=
set
(
gof
.
graph
.
var
iables
(
self
.
fgraph
.
inputs
,
self
.
fgraph
.
outputs
)
gof
.
graph
.
var
s_between
(
self
.
fgraph
.
inputs
,
self
.
fgraph
.
outputs
)
)
# check_integrity parameters was added to ignore
# "excess cached variables" errors. Works that way
...
...
theano/gof/fg.py
浏览文件 @
d70c1cc6
...
...
@@ -9,8 +9,7 @@ from theano.gof import toolbox, utils
from
theano.gof.graph
import
Apply
,
Constant
,
Variable
,
applys_between
from
theano.gof.graph
import
as_string
as
graph_as_string
from
theano.gof.graph
import
clone
as
clone_graph
from
theano.gof.graph
import
clone_get_equiv
,
io_toposort
from
theano.gof.graph
import
variables
as
variables_between
from
theano.gof.graph
import
clone_get_equiv
,
io_toposort
,
vars_between
from
theano.gof.utils
import
TestValueError
,
get_variable_trace_string
from
theano.misc.ordered_set
import
OrderedSet
...
...
@@ -725,7 +724,7 @@ class FunctionGraph(utils.MetaObject):
raise
Exception
(
f
"Inconsistent clients list {(node, i)} in {clients}"
)
variables
=
set
(
var
iable
s_between
(
self
.
inputs
,
self
.
outputs
))
variables
=
set
(
vars_between
(
self
.
inputs
,
self
.
outputs
))
if
set
(
self
.
variables
)
!=
variables
:
missing
=
variables
.
difference
(
self
.
variables
)
excess
=
self
.
variables
.
difference
(
variables
)
...
...
theano/gof/graph.py
浏览文件 @
d70c1cc6
...
...
@@ -781,7 +781,7 @@ def inputs(
yield
from
(
r
for
r
in
ancestors
(
graphs
,
blockers
)
if
r
.
owner
is
None
)
def
var
iables
(
def
var
s_between
(
ins
:
Collection
[
Variable
],
outs
:
Iterable
[
Variable
]
)
->
Generator
[
Variable
,
None
,
None
]:
"""Extract the `Variable`s within the sub-graph between input and output nodes.
...
...
@@ -835,7 +835,7 @@ def orphans(
[y]
"""
yield
from
(
r
for
r
in
var
iables
(
ins
,
outs
)
if
r
.
owner
is
None
and
r
not
in
ins
)
yield
from
(
r
for
r
in
var
s_between
(
ins
,
outs
)
if
r
.
owner
is
None
and
r
not
in
ins
)
def
applys_between
(
...
...
@@ -860,7 +860,7 @@ def applys_between(
"""
yield
from
(
r
.
owner
for
r
in
var
iables
(
ins
,
outs
)
if
r
not
in
ins
and
r
.
owner
is
not
None
r
.
owner
for
r
in
var
s_between
(
ins
,
outs
)
if
r
not
in
ins
and
r
.
owner
is
not
None
)
...
...
theano/gof/toolbox.py
浏览文件 @
d70c1cc6
...
...
@@ -10,7 +10,7 @@ import numpy as np
import
theano
from
theano.configdefaults
import
config
from
theano.gof.graph
import
equal_computations
,
inputs
,
io_toposort
,
var
iables
from
theano.gof.graph
import
equal_computations
,
inputs
,
io_toposort
,
var
s_between
class
AlreadyThere
(
Exception
):
...
...
@@ -895,7 +895,7 @@ def is_same_graph(var1, var2, givens=None):
# Compute the sets of all variables found in each computational graph.
inputs_var
=
list
(
map
(
inputs
,
([
var1
],
[
var2
])))
all_vars
=
[
set
(
var
iables
(
v_i
,
v_o
))
set
(
var
s_between
(
v_i
,
v_o
))
for
v_i
,
v_o
in
((
inputs_var
[
0
],
[
var1
]),
(
inputs_var
[
1
],
[
var2
]))
]
...
...
theano/link/c/basic.py
浏览文件 @
d70c1cc6
...
...
@@ -14,8 +14,7 @@ import numpy as np
from
theano.compile.compilelock
import
lock_ctx
from
theano.configdefaults
import
config
from
theano.gof.callcache
import
CallCache
from
theano.gof.graph
import
Constant
,
NoParams
,
io_toposort
from
theano.gof.graph
import
variables
as
get_variables
from
theano.gof.graph
import
Constant
,
NoParams
,
io_toposort
,
vars_between
from
theano.gof.utils
import
MethodNotDefined
from
theano.link.basic
import
Container
,
Linker
,
LocalLinker
,
PerformLinker
from
theano.link.c.cmodule
import
(
...
...
@@ -637,7 +636,7 @@ class CLinker(Linker):
# We need to include the unused inputs in our variables,
# otherwise we can't pass them to the module.
self
.
variables
=
[
var
for
var
in
self
.
inputs
if
not
len
(
fgraph
.
clients
[
var
])]
self
.
variables
+=
list
(
get_variables
(
self
.
inputs
,
self
.
outputs
))
self
.
variables
+=
list
(
vars_between
(
self
.
inputs
,
self
.
outputs
))
# This adds a hidden input which is the params for each node
# that needs it
...
...
theano/tensor/nnet/bn.py
浏览文件 @
d70c1cc6
...
...
@@ -827,7 +827,7 @@ def local_abstract_batch_norm_train(fgraph, node):
for
(
r
,
r_orig
)
in
zip
(
results
,
node
.
outputs
)
]
for
var
in
theano
.
gof
.
graph
.
var
iables
(
node
.
inputs
,
results
):
for
var
in
theano
.
gof
.
graph
.
var
s_between
(
node
.
inputs
,
results
):
if
var
not
in
node
.
inputs
:
copy_stack_trace
(
node
.
outputs
[
0
],
var
)
return
results
...
...
@@ -866,7 +866,7 @@ def local_abstract_batch_norm_train_grad(fgraph, node):
for
(
r
,
r_orig
)
in
zip
(
results
,
node
.
outputs
)
]
for
var
in
theano
.
gof
.
graph
.
var
iables
(
node
.
inputs
,
results
):
for
var
in
theano
.
gof
.
graph
.
var
s_between
(
node
.
inputs
,
results
):
if
var
not
in
node
.
inputs
:
copy_stack_trace
(
node
.
outputs
[
0
],
var
)
return
results
...
...
@@ -898,7 +898,7 @@ def local_abstract_batch_norm_inference(fgraph, node):
)
+
bias
result
=
tt
.
patternbroadcast
(
result
,
node
.
outputs
[
0
]
.
broadcastable
)
for
var
in
theano
.
gof
.
graph
.
var
iables
(
node
.
inputs
,
[
result
]):
for
var
in
theano
.
gof
.
graph
.
var
s_between
(
node
.
inputs
,
[
result
]):
if
var
not
in
node
.
inputs
:
copy_stack_trace
(
node
.
outputs
[
0
],
var
)
return
[
result
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论