Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
e1a56c57
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看板
提交
e1a56c57
编写于
6月 12, 2019
作者:
S
superjomn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compile
test=develop
上级
fb600267
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
12 deletion
+11
-12
paddle/fluid/lite/api/light_api.h
paddle/fluid/lite/api/light_api.h
+4
-5
paddle/fluid/lite/kernels/x86/sgd_compute.cc
paddle/fluid/lite/kernels/x86/sgd_compute.cc
+7
-7
未找到文件。
paddle/fluid/lite/api/light_api.h
浏览文件 @
e1a56c57
...
@@ -72,9 +72,8 @@ class LightPredictor {
...
@@ -72,9 +72,8 @@ class LightPredictor {
// Create the kernels of the target places, and filter out the specific
// Create the kernels of the target places, and filter out the specific
// kernel with the target alias.
// kernel with the target alias.
for
(
auto
&
op
:
program
.
ops_
)
{
for
(
auto
&
op
:
program
.
ops
())
{
lite
::
pb
::
OpDesc
desc
(
op
->
op_info
()
->
desc
());
auto
kernel_type
=
op
->
op_info
()
->
GetAttr
<
std
::
string
>
(
kKernelTypeAttr
);
auto
kernel_type
=
desc
.
GetAttr
(
kKernelTypeAttr
).
get
<
std
::
string
>
();
std
::
string
op_type
,
alias
;
std
::
string
op_type
,
alias
;
Place
place
;
Place
place
;
KernelBase
::
ParseKernelType
(
kernel_type
,
&
op_type
,
&
alias
,
&
place
);
KernelBase
::
ParseKernelType
(
kernel_type
,
&
op_type
,
&
alias
,
&
place
);
...
@@ -89,8 +88,8 @@ class LightPredictor {
...
@@ -89,8 +88,8 @@ class LightPredictor {
insts
.
emplace_back
(
op
,
std
::
move
(
*
it
));
insts
.
emplace_back
(
op
,
std
::
move
(
*
it
));
}
}
program_
.
reset
(
new
RuntimeProgram
(
std
::
move
(
insts
)));
program_
.
reset
(
new
RuntimeProgram
(
std
::
move
(
insts
)));
CHECK
(
program
.
exec_scope
_
);
CHECK
(
program
.
exec_scope
()
);
program_
->
set_exec_scope
(
program
.
exec_scope
_
);
program_
->
set_exec_scope
(
program
.
exec_scope
()
);
}
}
private:
private:
...
...
paddle/fluid/lite/kernels/x86/sgd_compute.cc
浏览文件 @
e1a56c57
...
@@ -29,9 +29,9 @@ class SGDCompute : public KernelLite<TARGET(kX86), PRECISION(kFloat)> {
...
@@ -29,9 +29,9 @@ class SGDCompute : public KernelLite<TARGET(kX86), PRECISION(kFloat)> {
using
param_t
=
operators
::
ActivationParam
;
using
param_t
=
operators
::
ActivationParam
;
void
Run
()
override
{
void
Run
()
override
{
auto
&
context
=
c
ontext
_
->
As
<
X86Context
>
();
auto
&
context
=
c
tx
_
->
As
<
X86Context
>
();
auto
&
sgd_param
=
*
param_
.
get_mutable
<
operators
::
SGDParam
>
();
auto
&
sgd_param
=
*
param_
.
get_mutable
<
operators
::
SGDParam
>
();
CHECK
(
context
.
x86_device_context
);
CHECK
(
context
.
x86_device_context
()
);
// param.Out->template mutable_data<T>();
// param.Out->template mutable_data<T>();
...
@@ -45,12 +45,12 @@ class SGDCompute : public KernelLite<TARGET(kX86), PRECISION(kFloat)> {
...
@@ -45,12 +45,12 @@ class SGDCompute : public KernelLite<TARGET(kX86), PRECISION(kFloat)> {
PADDLE_ENFORCE_EQ
(
grad
->
numel
(),
sz
);
PADDLE_ENFORCE_EQ
(
grad
->
numel
(),
sz
);
paddle
::
operators
::
jit
::
sgd_attr_t
attr
(
1
,
sz
,
1
,
sz
,
1
);
paddle
::
operators
::
jit
::
sgd_attr_t
attr
(
1
,
sz
,
1
,
sz
,
1
);
const
T
*
lr
=
learning_rate
->
data
<
T
>
();
const
T
*
lr
=
learning_rate
->
template
data
<
T
>();
const
T
*
param_data
=
param
->
data
<
T
>
();
const
T
*
param_data
=
param
->
template
data
<
T
>();
const
T
*
grad_data
=
grad
->
data
<
T
>
();
const
T
*
grad_data
=
grad
->
template
data
<
T
>();
int64_t
rows_idx
=
0
;
int64_t
rows_idx
=
0
;
T
*
out_data
=
T
*
out_data
=
param_out
->
template
mutable_data
<
T
>(
param_out
->
mutable_data
<
T
>
(
context
.
x86_device_context
->
GetPlace
());
context
.
x86_device_context
()
->
GetPlace
());
auto
sgd
=
auto
sgd
=
paddle
::
operators
::
jit
::
KernelFuncs
<
paddle
::
operators
::
jit
::
SgdTuple
<
T
>
,
paddle
::
operators
::
jit
::
KernelFuncs
<
paddle
::
operators
::
jit
::
SgdTuple
<
T
>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录