Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7668d632
提交
7668d632
authored
11月 21, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix docstrings and argument names in the Feature class
上级
ff3a67f1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
32 行增加
和
32 行删除
+32
-32
toolbox.py
theano/gof/toolbox.py
+32
-32
没有找到文件。
theano/gof/toolbox.py
浏览文件 @
7668d632
...
@@ -235,62 +235,62 @@ class Feature:
...
@@ -235,62 +235,62 @@ class Feature:
"""
"""
def
on_attach
(
self
,
f
unction_
graph
):
def
on_attach
(
self
,
fgraph
):
"""
"""
Called by
FunctionGraph.attach_feature, the method that attaches
Called by
`FunctionGraph.attach_feature`, the method that attaches the
the feature to the FunctionGraph
. Since this is called after the
feature to the `FunctionGraph`
. Since this is called after the
FunctionGraph is initially populated, this is where you should
`FunctionGraph` is initially populated, this is where you should run
run checks on the initial contents of the FunctionGraph
.
checks on the initial contents of the `FunctionGraph`
.
The on_attach method may raise the
AlreadyThere
exception to cancel
The on_attach method may raise the
`AlreadyThere`
exception to cancel
the attach operation if it detects that another Feature instance
the attach operation if it detects that another Feature instance
implementing the same functionality is already atttached to the
implementing the same functionality is already attached to the
FunctionGraph.
`FunctionGraph`.
The feature has great freedom in what it can do with the
function_graph: it may, for example, add methods to it dynamically.
"""
The feature has great freedom in what it can do with the `fgraph`: it
may, for example, add methods to it dynamically.
def
on_detach
(
self
,
function_graph
):
"""
"""
Called by remove_feature(feature). Should remove any dynamically-added
functionality that it installed into the function_graph.
def
on_detach
(
self
,
fgraph
):
"""
"""
Called by `FunctionGraph.remove_feature`. Should remove any
dynamically-added functionality that it installed into the fgraph.
def
on_import
(
self
,
function_graph
,
node
,
reason
):
"""
"""
Called whenever a node is imported into function_graph, which is
just before the node is actually connected to the graph.
Note: on_import is not called when the graph is created. If you
want to detect the first nodes to be implemented to the graph,
you should do this by implementing on_attach.
def
on_import
(
self
,
fgraph
,
node
,
reason
):
"""
"""
Called whenever a node is imported into `fgraph`, which is just before
the node is actually connected to the graph.
def
on_prune
(
self
,
function_graph
,
node
,
reason
):
Note: this is not called when the graph is created. If you want to
"""
detect the first nodes to be implemented to the graph, you should do
Called whenever a node is pruned (removed) from the function_graph,
this by implementing `on_attach`.
after it is disconnected from the graph.
"""
"""
def
on_change_input
(
self
,
f
unction_graph
,
node
,
i
,
r
,
new_
r
,
reason
=
None
):
def
on_change_input
(
self
,
f
graph
,
node
,
i
,
var
,
new_va
r
,
reason
=
None
):
"""
"""
Called whenever node.inputs[i] is changed from r to new_r.
Called whenever ``node.inputs[i]`` is changed from `var` to `new_var`.
At the moment the callback is done, the change has already
At the moment the callback is done, the change has already taken place.
taken place.
If you raise an exception in this function, the state of the graph
If you raise an exception in this function, the state of the graph
might be broken for all intents and purposes.
might be broken for all intents and purposes.
"""
"""
def
orderings
(
self
,
function_graph
):
def
on_prune
(
self
,
fgraph
,
node
,
reason
):
"""
Called whenever a node is pruned (removed) from the `fgraph`, after it
is disconnected from the graph.
"""
def
orderings
(
self
,
fgraph
):
"""
"""
Called by
toposort
. It should return a dictionary of
Called by
`FunctionGraph.toposort`
. It should return a dictionary of
{node: predecessors} where predecessors
is a list of
``{node: predecessors}`` where ``predecessors``
is a list of
nodes that should be computed before the key node.
nodes that should be computed before the key node.
If you raise an exception in this function, the state of the graph
If you raise an exception in this function, the state of the graph
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论