Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
94255f6c
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
94255f6c
编写于
11月 19, 2019
作者:
Y
yiicy
提交者:
GitHub
11月 19, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix lrn param, align to fluid, test=develop (#2452)
上级
8373aec5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
13 addition
and
10 deletion
+13
-10
lite/kernels/arm/lrn_compute.cc
lite/kernels/arm/lrn_compute.cc
+4
-3
lite/kernels/arm/lrn_compute_test.cc
lite/kernels/arm/lrn_compute_test.cc
+2
-2
lite/operators/lrn_op.cc
lite/operators/lrn_op.cc
+4
-2
lite/operators/op_params.h
lite/operators/op_params.h
+2
-2
lite/tests/kernels/lrn_compute_test.cc
lite/tests/kernels/lrn_compute_test.cc
+1
-1
未找到文件。
lite/kernels/arm/lrn_compute.cc
浏览文件 @
94255f6c
...
@@ -31,16 +31,16 @@ void LrnCompute::Run() {
...
@@ -31,16 +31,16 @@ void LrnCompute::Run() {
int
channel
=
x_dims
[
1
];
int
channel
=
x_dims
[
1
];
int
h
=
x_dims
[
2
];
int
h
=
x_dims
[
2
];
int
w
=
x_dims
[
3
];
int
w
=
x_dims
[
3
];
const
int
local_size
=
param
.
local_size
;
const
int
n
=
param
.
n
;
const
float
alpha
=
param
.
alpha
;
const
float
alpha
=
param
.
alpha
;
const
float
beta
=
param
.
beta
;
const
float
beta
=
param
.
beta
;
const
float
k
=
param
.
k
;
const
float
k
=
param
.
k
;
if
(
param
.
norm_region
==
"AcrossChannels"
)
{
if
(
param
.
norm_region
==
"AcrossChannels"
)
{
lite
::
arm
::
math
::
compute_across_channels
(
lite
::
arm
::
math
::
compute_across_channels
(
x_data
,
out_data
,
num
,
channel
,
h
,
w
,
local_size
,
alpha
,
beta
,
k
);
x_data
,
out_data
,
num
,
channel
,
h
,
w
,
n
,
alpha
,
beta
,
k
);
}
else
{
}
else
{
lite
::
arm
::
math
::
compute_within_channels
(
lite
::
arm
::
math
::
compute_within_channels
(
x_data
,
out_data
,
num
,
channel
,
h
,
w
,
local_size
,
alpha
,
beta
,
k
);
x_data
,
out_data
,
num
,
channel
,
h
,
w
,
n
,
alpha
,
beta
,
k
);
}
}
}
}
...
@@ -53,4 +53,5 @@ REGISTER_LITE_KERNEL(
...
@@ -53,4 +53,5 @@ REGISTER_LITE_KERNEL(
lrn
,
kARM
,
kFloat
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
LrnCompute
,
def
)
lrn
,
kARM
,
kFloat
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
LrnCompute
,
def
)
.
BindInput
(
"X"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
BindInput
(
"X"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
BindOutput
(
"MidOut"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
Finalize
();
.
Finalize
();
lite/kernels/arm/lrn_compute_test.cc
浏览文件 @
94255f6c
...
@@ -91,7 +91,7 @@ void lrn_compute_ref(const operators::LrnParam& param) {
...
@@ -91,7 +91,7 @@ void lrn_compute_ref(const operators::LrnParam& param) {
const
dtype
*
x_data
=
param
.
X
->
data
<
const
dtype
>
();
const
dtype
*
x_data
=
param
.
X
->
data
<
const
dtype
>
();
dtype
*
out_data
=
param
.
Out
->
mutable_data
<
dtype
>
();
dtype
*
out_data
=
param
.
Out
->
mutable_data
<
dtype
>
();
auto
x_dims
=
param
.
X
->
dims
();
auto
x_dims
=
param
.
X
->
dims
();
int
local_size
=
param
.
local_size
;
int
local_size
=
param
.
n
;
float
alpha
=
param
.
alpha
;
float
alpha
=
param
.
alpha
;
float
beta
=
param
.
beta
;
float
beta
=
param
.
beta
;
float
k
=
param
.
k
;
float
k
=
param
.
k
;
...
@@ -171,7 +171,7 @@ TEST(lrn_arm, compute) {
...
@@ -171,7 +171,7 @@ TEST(lrn_arm, compute) {
}
}
param
.
X
=
&
x
;
param
.
X
=
&
x
;
param
.
Out
=
&
output
;
param
.
Out
=
&
output
;
param
.
local_size
=
local_size
;
param
.
n
=
local_size
;
param
.
alpha
=
alpha
;
param
.
alpha
=
alpha
;
param
.
beta
=
beta
;
param
.
beta
=
beta
;
param
.
k
=
k
;
param
.
k
=
k
;
...
...
lite/operators/lrn_op.cc
浏览文件 @
94255f6c
...
@@ -37,11 +37,13 @@ bool LrnOpLite::AttachImpl(const cpp::OpDesc& opdesc, lite::Scope* scope) {
...
@@ -37,11 +37,13 @@ bool LrnOpLite::AttachImpl(const cpp::OpDesc& opdesc, lite::Scope* scope) {
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
param_
.
X
=
GetVar
<
lite
::
Tensor
>
(
scope
,
X_name
);
param_
.
X
=
GetVar
<
lite
::
Tensor
>
(
scope
,
X_name
);
param_
.
Out
=
GetMutableVar
<
lite
::
Tensor
>
(
scope
,
Out_name
);
param_
.
Out
=
GetMutableVar
<
lite
::
Tensor
>
(
scope
,
Out_name
);
param_
.
local_size
=
opdesc
.
GetAttr
<
int
>
(
"local_size
"
);
param_
.
n
=
opdesc
.
GetAttr
<
int
>
(
"n
"
);
param_
.
alpha
=
opdesc
.
GetAttr
<
float
>
(
"alpha"
);
param_
.
alpha
=
opdesc
.
GetAttr
<
float
>
(
"alpha"
);
param_
.
beta
=
opdesc
.
GetAttr
<
float
>
(
"beta"
);
param_
.
beta
=
opdesc
.
GetAttr
<
float
>
(
"beta"
);
param_
.
k
=
opdesc
.
GetAttr
<
float
>
(
"k"
);
param_
.
k
=
opdesc
.
GetAttr
<
float
>
(
"k"
);
param_
.
norm_region
=
opdesc
.
GetAttr
<
std
::
string
>
(
"norm_region"
);
if
(
opdesc
.
HasAttr
(
"norm_region"
))
{
param_
.
norm_region
=
opdesc
.
GetAttr
<
std
::
string
>
(
"norm_region"
);
}
return
true
;
return
true
;
}
}
...
...
lite/operators/op_params.h
浏览文件 @
94255f6c
...
@@ -522,8 +522,8 @@ struct GRUUnitParam {
...
@@ -522,8 +522,8 @@ struct GRUUnitParam {
struct
LrnParam
{
struct
LrnParam
{
const
lite
::
Tensor
*
X
{};
const
lite
::
Tensor
*
X
{};
lite
::
Tensor
*
Out
{};
lite
::
Tensor
*
Out
{};
int
local_size
{
5
};
int
n
{
5
};
float
alpha
{
1
.
};
float
alpha
{
1
e-4
};
float
beta
{
0.75
};
float
beta
{
0.75
};
float
k
{
1.
};
float
k
{
1.
};
std
::
string
norm_region
{
"AcrossChannels"
};
std
::
string
norm_region
{
"AcrossChannels"
};
...
...
lite/tests/kernels/lrn_compute_test.cc
浏览文件 @
94255f6c
...
@@ -158,7 +158,7 @@ class LrnComputeTester : public arena::TestCase {
...
@@ -158,7 +158,7 @@ class LrnComputeTester : public arena::TestCase {
op_desc
->
SetOutput
(
"Out"
,
{
output_
});
op_desc
->
SetOutput
(
"Out"
,
{
output_
});
op_desc
->
SetAttr
(
"alpha"
,
alpha_
);
op_desc
->
SetAttr
(
"alpha"
,
alpha_
);
op_desc
->
SetAttr
(
"beta"
,
beta_
);
op_desc
->
SetAttr
(
"beta"
,
beta_
);
op_desc
->
SetAttr
(
"
local_size
"
,
local_size_
);
op_desc
->
SetAttr
(
"
n
"
,
local_size_
);
op_desc
->
SetAttr
(
"k"
,
k_
);
op_desc
->
SetAttr
(
"k"
,
k_
);
op_desc
->
SetAttr
(
"norm_region"
,
norm_region_
);
op_desc
->
SetAttr
(
"norm_region"
,
norm_region_
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录