Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b40fe366
提交
b40fe366
authored
9月 13, 2012
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
made Apply and Variable into subclasses of Node
上级
75e65054
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
23 行增加
和
6 行删除
+23
-6
destroyhandler.py
theano/gof/destroyhandler.py
+3
-4
graph.py
theano/gof/graph.py
+20
-2
没有找到文件。
theano/gof/destroyhandler.py
浏览文件 @
b40fe366
...
@@ -160,13 +160,12 @@ def _contains_cycle(inputs, outputs, orderings):
...
@@ -160,13 +160,12 @@ def _contains_cycle(inputs, outputs, orderings):
fifo_queue
.
append
(
node
)
fifo_queue
.
append
(
node
)
node_to_parents
[
node
]
=
parents
node_to_parents
[
node
]
=
parents
rset
=
set
()
rset
=
set
()
rlist
=
[]
visit_count
=
0
while
fifo_queue
:
while
fifo_queue
:
node
=
fifo_queue
.
popleft
()
node
=
fifo_queue
.
popleft
()
if
node
not
in
rset
:
if
node
not
in
rset
:
rlist
.
append
(
node
)
visit_count
+=
1
rset
.
add
(
node
)
rset
.
add
(
node
)
for
client
in
node_to_children
.
get
(
node
,
[]):
for
client
in
node_to_children
.
get
(
node
,
[]):
node_to_parents
[
client
]
=
[
a
for
a
in
node_to_parents
[
client
]
if
a
is
not
node
]
node_to_parents
[
client
]
=
[
a
for
a
in
node_to_parents
[
client
]
if
a
is
not
node
]
...
@@ -174,7 +173,7 @@ def _contains_cycle(inputs, outputs, orderings):
...
@@ -174,7 +173,7 @@ def _contains_cycle(inputs, outputs, orderings):
fifo_queue
.
append
(
client
)
fifo_queue
.
append
(
client
)
return
len
(
rlist
)
!=
len
(
node_to_parents
.
keys
())
return
visit_count
!=
len
(
node_to_parents
.
keys
())
...
...
theano/gof/graph.py
浏览文件 @
b40fe366
...
@@ -21,7 +21,25 @@ is_same_graph_with_merge = None
...
@@ -21,7 +21,25 @@ is_same_graph_with_merge = None
equal_computations
=
None
equal_computations
=
None
class
Apply
(
utils
.
object2
):
class
Node
(
utils
.
object2
):
"""A Node in a theano graph.
Graphs contain two kinds of Nodes--
Variable and Apply.
Edges in the graph are not explicitly represented.
Instead each Node keeps track of its parents via
Variable.owner / Apply.inputs and its children
via Variable.clients / Apply.outputs.
"""
def
get_parents
(
self
):
""" Return a list of the parents of this node.
Should return a copy--i.e., modifying the return
value should not modify the graph structure."""
raise
NotImplementedError
()
class
Apply
(
Node
):
"""
"""
An :term:`Apply` instance is a node in an expression graph which represents the application
An :term:`Apply` instance is a node in an expression graph which represents the application
of an `Op` to some input `Variable` nodes, producing some output `Variable` nodes.
of an `Op` to some input `Variable` nodes, producing some output `Variable` nodes.
...
@@ -213,7 +231,7 @@ class Apply(utils.object2):
...
@@ -213,7 +231,7 @@ class Apply(utils.object2):
"""property: Number of outputs"""
"""property: Number of outputs"""
class
Variable
(
utils
.
object2
):
class
Variable
(
Node
):
"""
"""
A :term:`Variable` is a node in an expression graph that represents a variable.
A :term:`Variable` is a node in an expression graph that represents a variable.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论