Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
54893145
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
54893145
编写于
2月 25, 2019
作者:
Z
Zhen Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update some functions' names according to the suggestion. test=develop
上级
9261cf39
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
27 deletion
+28
-27
paddle/fluid/pybind/ir.cc
paddle/fluid/pybind/ir.cc
+7
-6
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+21
-21
未找到文件。
paddle/fluid/pybind/ir.cc
浏览文件 @
54893145
...
...
@@ -14,6 +14,7 @@
#include "paddle/fluid/pybind/ir.h"
#include <algorithm>
#include <memory>
#include <string>
#include <unordered_map>
#include <unordered_set>
...
...
@@ -115,7 +116,7 @@ void BindNode(py::module *m) {
.
def
(
"is_var"
,
&
Node
::
IsVar
)
.
def
(
"is_ctrl_var"
,
&
Node
::
IsCtrlVar
)
.
def
(
"clear_inputs"
,
[](
Node
&
self
)
{
self
.
inputs
.
clear
();
})
.
def
(
"
inputs_remove
"
,
.
def
(
"
remove_input
"
,
[](
Node
&
self
,
int
node_id
)
{
auto
pos
=
std
::
find_if
(
self
.
inputs
.
begin
(),
self
.
inputs
.
end
(),
...
...
@@ -124,7 +125,7 @@ void BindNode(py::module *m) {
self
.
inputs
.
erase
(
pos
);
}
})
.
def
(
"
inputs_remove
"
,
.
def
(
"
remove_input
"
,
[](
Node
&
self
,
Node
&
node
)
{
auto
pos
=
std
::
find
(
self
.
inputs
.
begin
(),
self
.
inputs
.
end
(),
&
node
);
...
...
@@ -132,10 +133,10 @@ void BindNode(py::module *m) {
self
.
inputs
.
erase
(
pos
);
}
})
.
def
(
"
inputs_append
"
,
.
def
(
"
append_input
"
,
[](
Node
&
self
,
Node
&
node
)
{
self
.
inputs
.
push_back
(
&
node
);
})
.
def
(
"clear_outputs"
,
[](
Node
&
self
)
{
self
.
outputs
.
clear
();
})
.
def
(
"
outputs_remove
"
,
.
def
(
"
remove_output
"
,
[](
Node
&
self
,
int
node_id
)
{
auto
pos
=
std
::
find_if
(
self
.
outputs
.
begin
(),
self
.
outputs
.
end
(),
...
...
@@ -144,7 +145,7 @@ void BindNode(py::module *m) {
self
.
outputs
.
erase
(
pos
);
}
})
.
def
(
"
outputs_remove
"
,
.
def
(
"
remove_output
"
,
[](
Node
&
self
,
Node
&
node
)
{
auto
pos
=
std
::
find
(
self
.
outputs
.
begin
(),
self
.
outputs
.
end
(),
&
node
);
...
...
@@ -152,7 +153,7 @@ void BindNode(py::module *m) {
self
.
outputs
.
erase
(
pos
);
}
})
.
def
(
"
outputs_append
"
,
.
def
(
"
append_output
"
,
[](
Node
&
self
,
Node
&
node
)
{
self
.
outputs
.
push_back
(
&
node
);
})
.
def_readwrite
(
"inputs"
,
&
Node
::
inputs
)
.
def_readwrite
(
"outputs"
,
&
Node
::
outputs
);
...
...
python/paddle/fluid/framework.py
浏览文件 @
54893145
...
...
@@ -1640,25 +1640,25 @@ class IrNode(object):
Args:
node_id(int): the given node id.
"""
self
.
node
.
inputs_remove
(
node_id
)
self
.
node
.
remove_input
(
node_id
)
def
inputs_remove
(
self
,
ir_
node
):
def
remove_input
(
self
,
node
):
"""
Remove a node from inputs.
Args:
ir_
node(IrNode): the node being removed.
node(IrNode): the node being removed.
"""
self
.
node
.
inputs_remove
(
ir_
node
.
node
)
self
.
node
.
remove_input
(
node
.
node
)
def
inputs_append
(
self
,
ir_
node
):
def
append_input
(
self
,
node
):
"""
Append a node in inputs.
Args:
ir_
node(IrNode): the node being appended.
node(IrNode): the node being appended.
"""
self
.
node
.
inputs_append
(
ir_
node
.
node
)
self
.
node
.
append_input
(
node
.
node
)
def
clear_outputs
(
self
):
"""
...
...
@@ -1667,32 +1667,32 @@ class IrNode(object):
"""
self
.
node
.
clear_outputs
()
def
outputs_remove
_by_id
(
self
,
node_id
):
def
remove_output
_by_id
(
self
,
node_id
):
"""
Remove a node from outputs by the given node id.
Args:
node_id(int): the given node id.
"""
self
.
node
.
outputs_remove
(
node_id
)
self
.
node
.
remove_output
(
node_id
)
def
outputs_remove
(
self
,
ir_
node
):
def
remove_output
(
self
,
node
):
"""
Remove a node from outputs.
Args:
ir_
node(IrNode): the node being removed.
node(IrNode): the node being removed.
"""
self
.
node
.
outputs_remove
(
ir_
node
.
node
)
self
.
node
.
remove_output
(
node
.
node
)
def
outputs_append
(
self
,
ir_
node
):
def
append_output
(
self
,
node
):
"""
Append a node in outputs.
Args:
ir_
node(IrNode): the node being appended.
node(IrNode): the node being appended.
"""
self
.
node
.
outputs_append
(
ir_
node
.
node
)
self
.
node
.
append_output
(
node
.
node
)
@
property
def
inputs
(
self
):
...
...
@@ -2116,10 +2116,10 @@ class IrGraph(object):
assert
old_input_node
.
node
in
self
.
graph
.
nodes
()
and
new_input_node
.
node
in
\
self
.
graph
.
nodes
()
and
op_node
.
node
in
self
.
graph
.
nodes
(),
\
'The three arguments(old_input_node&new_input_node&op_node) must be in the graph nodes.'
old_input_node
.
outputs_remove
(
op_node
)
op_node
.
inputs_remove
(
old_input_node
)
new_input_node
.
outputs_append
(
op_node
)
op_node
.
inputs_append
(
new_input_node
)
old_input_node
.
remove_output
(
op_node
)
op_node
.
remove_input
(
old_input_node
)
new_input_node
.
append_output
(
op_node
)
op_node
.
append_input
(
new_input_node
)
op_node
.
rename_input
(
old_input_node
.
name
(),
new_input_node
.
name
())
def
link_to
(
self
,
node_in
,
node_out
):
...
...
@@ -2132,8 +2132,8 @@ class IrGraph(object):
"""
assert
node_in
.
node
in
self
.
graph
.
nodes
()
and
node_out
.
node
in
self
.
graph
.
nodes
(),
\
'The two arguments(node_in&node_out) must be in the graph nodes.'
node_in
.
outputs_append
(
node_out
)
node_out
.
inputs_append
(
node_in
)
node_in
.
append_output
(
node_out
)
node_out
.
append_input
(
node_in
)
def
safe_remove_nodes
(
self
,
remove_nodes
):
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录