Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
兽拳
Paddle
提交
82571deb
P
Paddle
项目概览
兽拳
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82571deb
编写于
4月 26, 2018
作者:
Y
yangyaming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change `customize_loss_grad` to `use_default_grad_scale`.
上级
b8b2e897
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
11 deletion
+15
-11
paddle/fluid/framework/parallel_executor.cc
paddle/fluid/framework/parallel_executor.cc
+3
-3
paddle/fluid/framework/parallel_executor.h
paddle/fluid/framework/parallel_executor.h
+1
-1
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+5
-5
python/paddle/fluid/parallel_executor.py
python/paddle/fluid/parallel_executor.py
+6
-2
未找到文件。
paddle/fluid/framework/parallel_executor.cc
浏览文件 @
82571deb
...
@@ -58,7 +58,7 @@ ParallelExecutor::ParallelExecutor(
...
@@ -58,7 +58,7 @@ ParallelExecutor::ParallelExecutor(
const
std
::
unordered_set
<
std
::
string
>
&
bcast_vars
,
const
std
::
unordered_set
<
std
::
string
>
&
bcast_vars
,
const
ProgramDesc
&
main_program
,
const
std
::
string
&
loss_var_name
,
const
ProgramDesc
&
main_program
,
const
std
::
string
&
loss_var_name
,
Scope
*
scope
,
const
std
::
vector
<
Scope
*>
&
local_scopes
,
bool
allow_op_delay
,
Scope
*
scope
,
const
std
::
vector
<
Scope
*>
&
local_scopes
,
bool
allow_op_delay
,
bool
customize_scale_loss
)
bool
use_default_grad_scale
)
:
member_
(
new
ParallelExecutorPrivate
(
places
))
{
:
member_
(
new
ParallelExecutorPrivate
(
places
))
{
member_
->
global_scope_
=
scope
;
member_
->
global_scope_
=
scope
;
...
@@ -93,11 +93,11 @@ ParallelExecutor::ParallelExecutor(
...
@@ -93,11 +93,11 @@ ParallelExecutor::ParallelExecutor(
#ifdef PADDLE_WITH_CUDA
#ifdef PADDLE_WITH_CUDA
details
::
MultiDevSSAGraphBuilder
builder
(
details
::
MultiDevSSAGraphBuilder
builder
(
member_
->
places_
,
loss_var_name
,
params
,
member_
->
local_scopes_
,
member_
->
places_
,
loss_var_name
,
params
,
member_
->
local_scopes_
,
customize_scale_loss
,
member_
->
nccl_ctxs_
.
get
());
use_default_grad_scale
,
member_
->
nccl_ctxs_
.
get
());
#else
#else
details
::
MultiDevSSAGraphBuilder
builder
(
member_
->
places_
,
loss_var_name
,
details
::
MultiDevSSAGraphBuilder
builder
(
member_
->
places_
,
loss_var_name
,
params
,
member_
->
local_scopes_
,
params
,
member_
->
local_scopes_
,
customize_scale_loss
);
use_default_grad_scale
);
#endif
#endif
auto
graph
=
builder
.
Build
(
main_program
);
auto
graph
=
builder
.
Build
(
main_program
);
...
...
paddle/fluid/framework/parallel_executor.h
浏览文件 @
82571deb
...
@@ -40,7 +40,7 @@ class ParallelExecutor {
...
@@ -40,7 +40,7 @@ class ParallelExecutor {
const
ProgramDesc
&
main_program
,
const
ProgramDesc
&
main_program
,
const
std
::
string
&
loss_var_name
,
Scope
*
scope
,
const
std
::
string
&
loss_var_name
,
Scope
*
scope
,
const
std
::
vector
<
Scope
*>&
local_scopes
,
const
std
::
vector
<
Scope
*>&
local_scopes
,
bool
allow_op_delay
,
bool
customize_scale_loss
);
bool
allow_op_delay
,
bool
use_default_grad_scale
);
~
ParallelExecutor
();
~
ParallelExecutor
();
...
...
paddle/fluid/pybind/pybind.cc
浏览文件 @
82571deb
...
@@ -502,11 +502,11 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -502,11 +502,11 @@ All parameter, weight, gradient are variables in Paddle.
const
std
::
unordered_set
<
std
::
string
>
&
bcast_vars
,
const
std
::
unordered_set
<
std
::
string
>
&
bcast_vars
,
const
ProgramDesc
&
main_program
,
const
std
::
string
&
loss_var_name
,
const
ProgramDesc
&
main_program
,
const
std
::
string
&
loss_var_name
,
Scope
*
scope
,
std
::
vector
<
Scope
*>
&
local_scopes
,
Scope
*
scope
,
std
::
vector
<
Scope
*>
&
local_scopes
,
bool
allow_op_delay
,
bool
customize_loss_grad
)
{
bool
allow_op_delay
,
bool
use_default_grad_scale
)
{
new
(
&
self
)
ParallelExecutor
(
num_threads
,
use_event
,
places
,
new
(
&
self
)
ParallelExecutor
(
params
,
bcast_vars
,
main_program
,
num_threads
,
use_event
,
places
,
params
,
bcast_vars
,
loss_var_name
,
scope
,
local_scopes
,
main_program
,
loss_var_name
,
scope
,
local_scopes
,
allow_op_delay
,
customize_loss_grad
);
allow_op_delay
,
use_default_grad_scale
);
})
})
.
def
(
"bcast_params"
,
&
ParallelExecutor
::
BCastParamsToGPUs
)
.
def
(
"bcast_params"
,
&
ParallelExecutor
::
BCastParamsToGPUs
)
// NOTE: even we return a vec<Scope*>* to Python use reference policy.
// NOTE: even we return a vec<Scope*>* to Python use reference policy.
...
...
python/paddle/fluid/parallel_executor.py
浏览文件 @
82571deb
...
@@ -30,7 +30,7 @@ class ParallelExecutor(object):
...
@@ -30,7 +30,7 @@ class ParallelExecutor(object):
num_threads
=
None
,
num_threads
=
None
,
allow_op_delay
=
False
,
allow_op_delay
=
False
,
share_vars_from
=
None
,
share_vars_from
=
None
,
customize_loss_grad
=
Fals
e
):
use_default_grad_scale
=
Tru
e
):
"""
"""
ParallelExecutor can run program in parallel.
ParallelExecutor can run program in parallel.
...
@@ -46,6 +46,10 @@ class ParallelExecutor(object):
...
@@ -46,6 +46,10 @@ class ParallelExecutor(object):
improve performance in some cases, defalut False.
improve performance in some cases, defalut False.
share_vars_from(ParallelExecutor, default None): If provied,
share_vars_from(ParallelExecutor, default None): If provied,
it will share variables from the specified ParallelExecutor.
it will share variables from the specified ParallelExecutor.
use_default_grad_scale(bool, default True): If set True, a default
scale value equal to `1./device_count` would be multiplied to
the gradients. Otherwise, a customized scale value should be
feeded to the network.
Returns:
Returns:
A ParallelExecutor object.
A ParallelExecutor object.
...
@@ -124,7 +128,7 @@ class ParallelExecutor(object):
...
@@ -124,7 +128,7 @@ class ParallelExecutor(object):
scope
,
scope
,
local_scopes
,
local_scopes
,
allow_op_delay
,
allow_op_delay
,
customize_loss_grad
)
use_default_grad_scale
)
self
.
scope
=
scope
self
.
scope
=
scope
def
run
(
self
,
fetch_list
,
feed
=
None
,
feed_dict
=
None
):
def
run
(
self
,
fetch_list
,
feed
=
None
,
feed_dict
=
None
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录