Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
9f6aaa3c
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看板
提交
9f6aaa3c
编写于
8月 11, 2020
作者:
S
sandyhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reformat code, test=develop
上级
b1a23b82
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
79 addition
and
52 deletion
+79
-52
paddle/fluid/framework/pipeline_trainer.cc
paddle/fluid/framework/pipeline_trainer.cc
+1
-1
paddle/fluid/framework/section_worker.cc
paddle/fluid/framework/section_worker.cc
+69
-43
python/paddle/fluid/optimizer.py
python/paddle/fluid/optimizer.py
+9
-8
未找到文件。
paddle/fluid/framework/pipeline_trainer.cc
浏览文件 @
9f6aaa3c
...
@@ -254,7 +254,7 @@ void PipelineTrainer::Finalize() {
...
@@ -254,7 +254,7 @@ void PipelineTrainer::Finalize() {
const
LoDTensor
&
minibatch_tensor
=
minibatch_ptr
->
Get
<
LoDTensor
>
();
const
LoDTensor
&
minibatch_tensor
=
minibatch_ptr
->
Get
<
LoDTensor
>
();
TensorCopy
(
*
static_cast
<
const
Tensor
*>
(
&
minibatch_tensor
),
places_
[
0
],
TensorCopy
(
*
static_cast
<
const
Tensor
*>
(
&
minibatch_tensor
),
places_
[
0
],
static_cast
<
Tensor
*>
(
root_tensor
));
static_cast
<
Tensor
*>
(
root_tensor
));
VLOG
(
4
)
<<
"Copy persitable var "
<<
var
->
Name
()
<<
" to root scope"
;
VLOG
(
3
)
<<
"Copy persitable var "
<<
var
->
Name
()
<<
" to root scope"
;
}
}
}
}
}
}
...
...
paddle/fluid/framework/section_worker.cc
浏览文件 @
9f6aaa3c
...
@@ -154,6 +154,7 @@ void SectionWorker::TrainFiles() {
...
@@ -154,6 +154,7 @@ void SectionWorker::TrainFiles() {
}
}
}
}
dev_ctx_
->
Wait
();
dev_ctx_
->
Wait
();
VLOG
(
0
)
<<
"real_microbatch_num for thread 0 "
<<
real_microbatch_num
;
VLOG
(
0
)
<<
"real_microbatch_num for thread 0 "
<<
real_microbatch_num
;
// backward pass
// backward pass
for
(
int
i
=
0
;
i
<
real_microbatch_num
;
++
i
)
{
for
(
int
i
=
0
;
i
<
real_microbatch_num
;
++
i
)
{
...
@@ -391,11 +392,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -391,11 +392,13 @@ void SectionWorker::TrainFilesWithProfiler() {
op_total_time
[
op_idx
]
+=
time
;
op_total_time
[
op_idx
]
+=
time
;
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"::FWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:SCOPE["
<<
i
std
::
cout
<<
"::FWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:OP["
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:SCOPE["
<<
i
<<
"]:OP["
<<
op
->
Type
()
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
op_idx
++
;
op_idx
++
;
...
@@ -403,11 +406,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -403,11 +406,13 @@ void SectionWorker::TrainFilesWithProfiler() {
gettimeofday
(
&
micro_end
,
NULL
);
gettimeofday
(
&
micro_end
,
NULL
);
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"!!FWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
std
::
cout
<<
"!!FWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:START["
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:START["
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
catch
(
platform
::
EOFException
&
)
{
}
catch
(
platform
::
EOFException
&
)
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
thread_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
thread_mutex
);
...
@@ -467,11 +472,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -467,11 +472,13 @@ void SectionWorker::TrainFilesWithProfiler() {
op_total_time
[
op_idx
]
+=
time
;
op_total_time
[
op_idx
]
+=
time
;
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"::BWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:SCOPE["
<<
i
std
::
cout
<<
"::BWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:OP["
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:SCOPE["
<<
i
<<
"]:OP["
<<
op
->
Type
()
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
op_idx
++
;
op_idx
++
;
...
@@ -479,11 +486,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -479,11 +486,13 @@ void SectionWorker::TrainFilesWithProfiler() {
gettimeofday
(
&
micro_end
,
NULL
);
gettimeofday
(
&
micro_end
,
NULL
);
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"!!BWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
std
::
cout
<<
"!!BWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:START["
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:START["
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
dev_ctx_
->
Wait
();
dev_ctx_
->
Wait
();
...
@@ -522,11 +531,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -522,11 +531,13 @@ void SectionWorker::TrainFilesWithProfiler() {
op_total_time
[
op_idx
]
+=
time
;
op_total_time
[
op_idx
]
+=
time
;
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"::UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:SCOPE["
<<
num_microbatches_
std
::
cout
<<
"::UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:OP["
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:SCOPE["
<<
num_microbatches_
<<
"]:OP["
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
op_idx
++
;
op_idx
++
;
...
@@ -534,11 +545,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -534,11 +545,13 @@ void SectionWorker::TrainFilesWithProfiler() {
gettimeofday
(
&
micro_end
,
NULL
);
gettimeofday
(
&
micro_end
,
NULL
);
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"!!UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
std
::
cout
<<
"!!UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:START["
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:START["
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
dev_ctx_
->
Wait
();
dev_ctx_
->
Wait
();
batch_timer
.
Pause
();
batch_timer
.
Pause
();
...
@@ -582,7 +595,8 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -582,7 +595,8 @@ void SectionWorker::TrainFilesWithProfiler() {
lk
.
unlock
();
lk
.
unlock
();
VLOG
(
0
)
<<
"============timeline============"
;
VLOG
(
0
)
<<
"============timeline============"
;
for
(
size_t
i
=
0
;
i
<
ops_
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
ops_
.
size
();
++
i
)
{
VLOG
(
0
)
<<
"op: "
<<
op_name
[
i
]
<<
", max_time: "
<<
op_max_time
[
i
]
VLOG
(
0
)
<<
"op: "
<<
op_name
[
i
]
<<
", max_time: "
<<
op_max_time
[
i
]
<<
", min_time: "
<<
op_min_time
[
i
]
<<
", min_time: "
<<
op_min_time
[
i
]
<<
", mean_time: "
<<
op_total_time
[
i
]
/
op_count
[
i
];
<<
", mean_time: "
<<
op_total_time
[
i
]
/
op_count
[
i
];
}
}
...
@@ -632,11 +646,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -632,11 +646,13 @@ void SectionWorker::TrainFilesWithProfiler() {
op_total_time
[
op_idx
]
+=
time
;
op_total_time
[
op_idx
]
+=
time
;
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"::FWD:B["
<<
local_batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:SCOPE["
<<
i
std
::
cout
<<
"::FWD:B["
<<
local_batch_id_
<<
"]:SEC["
<<
"]:OP["
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
thread_id_
<<
"]:SCOPE["
<<
i
<<
"]:OP["
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
op_idx
++
;
op_idx
++
;
...
@@ -644,11 +660,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -644,11 +660,13 @@ void SectionWorker::TrainFilesWithProfiler() {
gettimeofday
(
&
micro_end
,
NULL
);
gettimeofday
(
&
micro_end
,
NULL
);
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"!!FWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
std
::
cout
<<
"!!FWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:START["
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:START["
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
dev_ctx_
->
Wait
();
dev_ctx_
->
Wait
();
...
@@ -685,11 +703,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -685,11 +703,13 @@ void SectionWorker::TrainFilesWithProfiler() {
op_total_time
[
op_idx
]
+=
time
;
op_total_time
[
op_idx
]
+=
time
;
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"::BWD:B["
<<
local_batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:SCOPE["
<<
i
std
::
cout
<<
"::BWD:B["
<<
local_batch_id_
<<
"]:SEC["
<<
"]:OP["
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
thread_id_
<<
"]:SCOPE["
<<
i
<<
"]:OP["
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
op_idx
++
;
op_idx
++
;
...
@@ -697,11 +717,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -697,11 +717,13 @@ void SectionWorker::TrainFilesWithProfiler() {
gettimeofday
(
&
micro_end
,
NULL
);
gettimeofday
(
&
micro_end
,
NULL
);
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"!!BWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
std
::
cout
<<
"!!BWD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:START["
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:START["
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
dev_ctx_
->
Wait
();
dev_ctx_
->
Wait
();
...
@@ -738,11 +760,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -738,11 +760,13 @@ void SectionWorker::TrainFilesWithProfiler() {
op_total_time
[
op_idx
]
+=
time
;
op_total_time
[
op_idx
]
+=
time
;
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"::UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:SCOPE["
<<
num_microbatches_
std
::
cout
<<
"::UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:OP["
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:SCOPE["
<<
num_microbatches_
<<
"]:OP["
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
op
->
Type
()
<<
"]:START["
<<
start
.
tv_sec
*
1e6
+
start
.
tv_usec
<<
"]:END["
<<
end
.
tv_sec
*
1e6
+
end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
}
}
op_idx
++
;
op_idx
++
;
...
@@ -750,11 +774,13 @@ void SectionWorker::TrainFilesWithProfiler() {
...
@@ -750,11 +774,13 @@ void SectionWorker::TrainFilesWithProfiler() {
gettimeofday
(
&
micro_end
,
NULL
);
gettimeofday
(
&
micro_end
,
NULL
);
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
cout_mutex
);
std
::
cout
<<
std
::
fixed
;
std
::
cout
<<
std
::
fixed
;
std
::
cout
.
precision
(
0
);
std
::
cout
.
precision
(
0
);
std
::
cout
<<
"!!UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
std
::
cout
<<
"!!UPD:B["
<<
batch_id_
<<
"]:SEC["
<<
thread_id_
<<
"]:START["
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:START["
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
<<
micro_start
.
tv_sec
*
1e6
+
micro_start
.
tv_usec
<<
"]:END["
<<
micro_end
.
tv_sec
*
1e6
+
micro_end
.
tv_usec
<<
"]"
<<
std
::
endl
;
}
}
dev_ctx_
->
Wait
();
dev_ctx_
->
Wait
();
if
(
local_completed
)
{
if
(
local_completed
)
{
...
...
python/paddle/fluid/optimizer.py
浏览文件 @
9f6aaa3c
...
@@ -1142,7 +1142,7 @@ class MomentumOptimizer(Optimizer):
...
@@ -1142,7 +1142,7 @@ class MomentumOptimizer(Optimizer):
class
DGCMomentumOptimizer
(
Optimizer
):
class
DGCMomentumOptimizer
(
Optimizer
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
DGC (Deep Gradient Compression) Momentum Optimizer. Original paper is https://arxiv.org/abs/1712.01887
DGC (Deep Gradient Compression) Momentum Optimizer. Original paper is https://arxiv.org/abs/1712.01887
...
@@ -3068,7 +3068,7 @@ Lamb = LambOptimizer
...
@@ -3068,7 +3068,7 @@ Lamb = LambOptimizer
class
ModelAverage
(
Optimizer
):
class
ModelAverage
(
Optimizer
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
The ModelAverage optimizer accumulates specific continuous historical parameters
The ModelAverage optimizer accumulates specific continuous historical parameters
during training. The accumulated historical range can be controlled by the passed
during training. The accumulated historical range can be controlled by the passed
...
@@ -3377,7 +3377,7 @@ class ModelAverage(Optimizer):
...
@@ -3377,7 +3377,7 @@ class ModelAverage(Optimizer):
class
ExponentialMovingAverage
(
object
):
class
ExponentialMovingAverage
(
object
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
Compute the moving average of parameters with exponential decay.
Compute the moving average of parameters with exponential decay.
Given a parameter :math:`
\\
theta`, its exponential moving average (EMA)
Given a parameter :math:`
\\
theta`, its exponential moving average (EMA)
...
@@ -3627,7 +3627,7 @@ class ExponentialMovingAverage(object):
...
@@ -3627,7 +3627,7 @@ class ExponentialMovingAverage(object):
class
PipelineOptimizer
(
object
):
class
PipelineOptimizer
(
object
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
Pipeline Optimizer: Make a program to run as pipeline, that is splitting a
Pipeline Optimizer: Make a program to run as pipeline, that is splitting a
program into multiple sections (sub-programs) and each section run on a
program into multiple sections (sub-programs) and each section run on a
...
@@ -4132,7 +4132,7 @@ class PipelineOptimizer(object):
...
@@ -4132,7 +4132,7 @@ class PipelineOptimizer(object):
index
=
0
,
index
=
0
,
type
=
'fill_constant'
,
type
=
'fill_constant'
,
inputs
=
{},
inputs
=
{},
outputs
=
{
'Out'
:[
grad_var
]},
outputs
=
{
'Out'
:
[
grad_var
]},
attrs
=
{
attrs
=
{
'shape'
:
grad_var
.
shape
,
'shape'
:
grad_var
.
shape
,
'dtype'
:
grad_var
.
dtype
,
'dtype'
:
grad_var
.
dtype
,
...
@@ -4326,6 +4326,7 @@ class PipelineOptimizer(object):
...
@@ -4326,6 +4326,7 @@ class PipelineOptimizer(object):
# attribute have not been set yet. Then check all ops have the
# attribute have not been set yet. Then check all ops have the
# op_device attribute.
# op_device attribute.
self
.
_add_default_opdevice_attr
(
main_block
)
self
.
_add_default_opdevice_attr
(
main_block
)
device_specs
=
self
.
_check_validation
(
main_block
)
device_specs
=
self
.
_check_validation
(
main_block
)
# Step3: add enqueue and dequeue ops between section boundaries
# Step3: add enqueue and dequeue ops between section boundaries
...
@@ -4388,7 +4389,7 @@ class PipelineOptimizer(object):
...
@@ -4388,7 +4389,7 @@ class PipelineOptimizer(object):
class
RecomputeOptimizer
(
Optimizer
):
class
RecomputeOptimizer
(
Optimizer
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
Recompute Optimizer Wrapper
Recompute Optimizer Wrapper
...
@@ -4473,7 +4474,7 @@ class RecomputeOptimizer(Optimizer):
...
@@ -4473,7 +4474,7 @@ class RecomputeOptimizer(Optimizer):
def
load
(
self
,
stat_dict
):
def
load
(
self
,
stat_dict
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
load function is not supported by Recompute Optimizer for now.
load function is not supported by Recompute Optimizer for now.
:return: None
:return: None
...
@@ -4697,7 +4698,7 @@ class RecomputeOptimizer(Optimizer):
...
@@ -4697,7 +4698,7 @@ class RecomputeOptimizer(Optimizer):
class
LookaheadOptimizer
(
object
):
class
LookaheadOptimizer
(
object
):
"""
"""
:api_attr: Static Graph
:api_attr: Static Graph
This implements the Lookahead optimizer of the
This implements the Lookahead optimizer of the
paper : https://arxiv.org/abs/1907.08610.
paper : https://arxiv.org/abs/1907.08610.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录