Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
c2b3838c
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
694
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c2b3838c
编写于
9月 25, 2018
作者:
X
Xin Pan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add some comments
上级
0d9ee0dc
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
17 addition
and
5 deletion
+17
-5
paddle/fluid/framework/details/build_strategy.cc
paddle/fluid/framework/details/build_strategy.cc
+5
-5
paddle/fluid/framework/details/build_strategy.h
paddle/fluid/framework/details/build_strategy.h
+8
-0
paddle/fluid/framework/ir/pass_builder.h
paddle/fluid/framework/ir/pass_builder.h
+4
-0
未找到文件。
paddle/fluid/framework/details/build_strategy.cc
浏览文件 @
c2b3838c
...
...
@@ -27,7 +27,7 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder {
public:
explicit
ParallelExecutorPassBuilder
(
const
BuildStrategy
&
strategy
)
:
ir
::
PassBuilder
(),
strategy_
(
strategy
)
{
// A
pply
a graph viz pass to record a graph.
// A
dd
a graph viz pass to record a graph.
if
(
!
strategy_
.
debug_graphviz_path_
.
empty
())
{
auto
viz_pass
=
AppendPass
(
"graph_viz_pass"
);
const
std
::
string
graph_path
=
string
::
Sprintf
(
...
...
@@ -35,10 +35,10 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder {
viz_pass
->
Set
<
std
::
string
>
(
"graph_viz_path"
,
new
std
::
string
(
graph_path
));
}
// A
pply
op fusion.
// A
dd
op fusion.
if
(
strategy
.
fuse_elewise_add_act_ops_
)
{
auto
fuse_elewise_add_act_pass
=
AppendPass
(
"fuse_elewise_add_act_pass"
);
// A
pply
a graph viz pass to record a graph.
// A
dd
a graph viz pass to record a graph.
if
(
!
strategy
.
debug_graphviz_path_
.
empty
())
{
auto
viz_pass
=
AppendPass
(
"graph_viz_pass"
);
const
std
::
string
graph_path
=
string
::
Sprintf
(
...
...
@@ -53,7 +53,7 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder {
multi_devices_pass
->
SetNotOwned
<
const
BuildStrategy
>
(
"strategy"
,
&
strategy_
);
// A
pply
a graph print pass to record a graph with device info.
// A
dd
a graph print pass to record a graph with device info.
if
(
!
strategy_
.
debug_graphviz_path_
.
empty
())
{
auto
multi_devices_print_pass
=
AppendPass
(
"multi_devices_print_pass"
);
multi_devices_print_pass
->
SetNotOwned
<
const
std
::
string
>
(
...
...
@@ -86,7 +86,7 @@ std::unique_ptr<ir::Graph> BuildStrategy::Apply(
#else
const
bool
use_cuda
)
const
{
#endif
// Create a default one if not intialized by user.
// Create a default one if not in
i
tialized by user.
if
(
!
pass_builder_
)
{
CreatePassesFromStrategy
();
}
...
...
paddle/fluid/framework/details/build_strategy.h
浏览文件 @
c2b3838c
...
...
@@ -69,8 +69,16 @@ struct BuildStrategy {
bool
enable_data_balance_
{
false
};
// The PassBuilder assembles passes based on the configs defined above.
// For example, if fuse_elewise_add_act_ops_ is true, the corresponding
// fuse pass will be added.
// The PassBuilder allows for more customized insert, remove of passes
// from python.
// A new PassBuilder is created and passes are owned by the PassBuilder.
std
::
shared_ptr
<
ir
::
PassBuilder
>
CreatePassesFromStrategy
()
const
;
// Apply the passes built by the pass_builder_. The passes will be
// applied to the Program and output an ir::Graph.
std
::
unique_ptr
<
ir
::
Graph
>
Apply
(
const
ProgramDesc
&
main_program
,
const
std
::
vector
<
platform
::
Place
>
&
places
,
...
...
paddle/fluid/framework/ir/pass_builder.h
浏览文件 @
c2b3838c
...
...
@@ -28,12 +28,16 @@ class PassBuilder {
virtual
~
PassBuilder
()
{}
// Append a new pass to the end.
std
::
shared_ptr
<
Pass
>
AppendPass
(
const
std
::
string
&
pass_type
);
// Insert a new pass after `idx`.
std
::
shared_ptr
<
Pass
>
InsertPass
(
size_t
idx
,
const
std
::
string
&
pass_type
);
// Remove a new pass at `idx`.
void
RemovePass
(
size_t
idx
);
// Returns a list of all passes.
std
::
vector
<
std
::
shared_ptr
<
Pass
>>
AllPasses
()
const
{
return
passes_
;
}
protected:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录