Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
0fc42012
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看板
提交
0fc42012
编写于
6月 10, 2017
作者:
D
dzhwinter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
"update interface"
上级
33b4deed
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
15 deletion
+8
-15
paddle/optimizer/adadelta_optimizer.h
paddle/optimizer/adadelta_optimizer.h
+0
-3
paddle/optimizer/adagrad_optimizer.h
paddle/optimizer/adagrad_optimizer.h
+2
-0
paddle/optimizer/adam_optimizer.cc
paddle/optimizer/adam_optimizer.cc
+0
-7
paddle/optimizer/adam_optimizer.h
paddle/optimizer/adam_optimizer.h
+5
-4
paddle/optimizer/serialization.h
paddle/optimizer/serialization.h
+1
-1
未找到文件。
paddle/optimizer/adadelta_optimizer.h
浏览文件 @
0fc42012
...
@@ -10,9 +10,6 @@ public:
...
@@ -10,9 +10,6 @@ public:
AdadeltaOptimizer
(
AdadeltaOptimizer
(
Tensor
*
parameter
,
LrPolicy
*
lr
,
double
rho
,
double
epsilon
,
double
decay
)
Tensor
*
parameter
,
LrPolicy
*
lr
,
double
rho
,
double
epsilon
,
double
decay
)
:
ParameterOptimizer
(
parameter
,
lr
),
:
ParameterOptimizer
(
parameter
,
lr
),
accum_gradient_
(
nullptr
),
accum_delta_
(
nullptr
),
update_delta_
(
nullptr
),
rho_
(
rho
),
rho_
(
rho
),
epsilon_
(
epsilon
),
epsilon_
(
epsilon
),
decay_
(
decay
)
{
decay_
(
decay
)
{
...
...
paddle/optimizer/adagrad_optimizer.h
浏览文件 @
0fc42012
...
@@ -20,6 +20,8 @@ public:
...
@@ -20,6 +20,8 @@ public:
if
(
accum_gradient_
)
delete
accum_gradient_
;
if
(
accum_gradient_
)
delete
accum_gradient_
;
}
}
void
Update
(
const
Tensor
*
gradient
);
void
Update
(
const
Tensor
*
gradient
);
const
char
*
SerializeState
(
int
*
state_len
);
void
DeSerializeState
(
const
std
::
string
&
state
);
private:
private:
Tensor
*
accum_gradient_
;
Tensor
*
accum_gradient_
;
...
...
paddle/optimizer/adam_optimizer.cc
浏览文件 @
0fc42012
...
@@ -4,13 +4,6 @@
...
@@ -4,13 +4,6 @@
namespace
paddle
{
namespace
paddle
{
namespace
optimizer
{
namespace
optimizer
{
void
AdamOptimizer
::
set_weight
(
Tensor
*
p
)
{
parameter_
=
p
;
size_t
size
=
p
->
size
();
momentums_
=
new
Tensor
(
size
);
velocitys_
=
new
Tensor
(
size
);
}
void
AdamOptimizer
::
Update
(
const
Tensor
*
gradient
)
{
void
AdamOptimizer
::
Update
(
const
Tensor
*
gradient
)
{
num_sample_passed_
+=
1
;
num_sample_passed_
+=
1
;
double
learning_rate
=
lr_policy_
->
LearningRate
(
num_sample_passed_
);
double
learning_rate
=
lr_policy_
->
LearningRate
(
num_sample_passed_
);
...
...
paddle/optimizer/adam_optimizer.h
浏览文件 @
0fc42012
...
@@ -13,18 +13,19 @@ public:
...
@@ -13,18 +13,19 @@ public:
double
epsilon
,
double
epsilon
,
double
decay
)
double
decay
)
:
ParameterOptimizer
(
parameter
,
lr
),
:
ParameterOptimizer
(
parameter
,
lr
),
momentums_
(
nullptr
),
velocitys_
(
nullptr
),
beta_1_
(
beta_1
),
beta_1_
(
beta_1
),
beta_2_
(
beta_2
),
beta_2_
(
beta_2
),
epsilon_
(
epsilon
),
epsilon_
(
epsilon
),
decay_
(
decay
)
{}
decay_
(
decay
)
{
size_t
size
=
p
->
size
();
momentums_
=
new
Tensor
(
size
);
velocitys_
=
new
Tensor
(
size
);
}
~
AdamOptimizer
()
{
~
AdamOptimizer
()
{
if
(
momentums_
)
delete
momentums_
;
if
(
momentums_
)
delete
momentums_
;
if
(
velocitys_
)
delete
velocitys_
;
if
(
velocitys_
)
delete
velocitys_
;
}
}
void
Update
(
const
Tensor
*
gradient
);
void
Update
(
const
Tensor
*
gradient
);
void
set_weight
(
Tensor
*
p
);
private:
private:
Tensor
*
momentums_
;
Tensor
*
momentums_
;
...
...
paddle/optimizer/serialization.h
浏览文件 @
0fc42012
...
@@ -17,7 +17,7 @@ unsigned CalStateSize(const HEAD& head, const TAIL&... tail) {
...
@@ -17,7 +17,7 @@ unsigned CalStateSize(const HEAD& head, const TAIL&... tail) {
if
(
std
::
is_fundamental
<
HEAD
>::
value
)
{
if
(
std
::
is_fundamental
<
HEAD
>::
value
)
{
return
sizeof
head
+
CalStateSize
(
tail
...);
return
sizeof
head
+
CalStateSize
(
tail
...);
}
else
{
}
else
{
return
sizeof
(
head
[
0
]
*
head
->
size
()
)
+
CalStateSize
(
tail
...);
return
sizeof
(
head
[
0
]
)
*
head
->
size
(
)
+
CalStateSize
(
tail
...);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录