Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
664bb9a8
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看板
提交
664bb9a8
编写于
9月 28, 2020
作者:
Z
zhangwen31
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[op][arm] mod: remove power_op, rename all `power` to `pow` test=develop
上级
8205860e
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
18 addition
and
133 deletion
+18
-133
docs/introduction/support_operation_list.md
docs/introduction/support_operation_list.md
+1
-2
lite/backends/arm/math/CMakeLists.txt
lite/backends/arm/math/CMakeLists.txt
+2
-2
lite/backends/arm/math/funcs.h
lite/backends/arm/math/funcs.h
+2
-1
lite/backends/arm/math/pow.cc
lite/backends/arm/math/pow.cc
+6
-5
lite/backends/arm/math/pow.h
lite/backends/arm/math/pow.h
+6
-6
lite/kernels/arm/pow_compute.cc
lite/kernels/arm/pow_compute.cc
+1
-3
lite/operators/CMakeLists.txt
lite/operators/CMakeLists.txt
+0
-1
lite/operators/power_op.cc
lite/operators/power_op.cc
+0
-53
lite/operators/power_op.h
lite/operators/power_op.h
+0
-60
未找到文件。
docs/introduction/support_operation_list.md
浏览文件 @
664bb9a8
...
@@ -159,8 +159,7 @@
...
@@ -159,8 +159,7 @@
| not_equal | Y | | | | | | | | | |
| not_equal | Y | | | | | | | | | |
| one_hot | Y | | | | | | | | | |
| one_hot | Y | | | | | | | | | |
| pixel_shuffle | Y | | | Y | Y | | | | | |
| pixel_shuffle | Y | | | Y | Y | | | | | |
| pow | | | | | | | | | | |
| pow | | | | Y | | | | | | |
| power | | | | Y | | | | | | |
| print | Y | | | | | | | | | |
| print | Y | | | | | | | | | |
| read_from_array | Y | | | | | | | | | |
| read_from_array | Y | | | | | | | | | |
| reciprocal | | | | Y | | | | | | |
| reciprocal | | | | Y | | | | | | |
...
...
lite/backends/arm/math/CMakeLists.txt
浏览文件 @
664bb9a8
...
@@ -101,7 +101,7 @@ if (NOT HAS_ARM_MATH_LIB_DIR)
...
@@ -101,7 +101,7 @@ if (NOT HAS_ARM_MATH_LIB_DIR)
activation.cc
activation.cc
yolo_box.cc
yolo_box.cc
dropout.cc
dropout.cc
power
.cc
pow
.cc
interpolate.cc
interpolate.cc
argmax.cc
argmax.cc
axpy.cc
axpy.cc
...
...
lite/backends/arm/math/funcs.h
浏览文件 @
664bb9a8
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#pragma once
#pragma once
#include <arm_neon.h>
#include <arm_neon.h>
#include <algorithm>
#include <algorithm>
#include <cmath>
#include <cmath>
...
@@ -48,7 +49,7 @@
...
@@ -48,7 +49,7 @@
#include "lite/backends/arm/math/packed_sgemm_c4.h"
#include "lite/backends/arm/math/packed_sgemm_c4.h"
#include "lite/backends/arm/math/pad2d.h"
#include "lite/backends/arm/math/pad2d.h"
#include "lite/backends/arm/math/pooling.h"
#include "lite/backends/arm/math/pooling.h"
#include "lite/backends/arm/math/pow
er
.h"
#include "lite/backends/arm/math/pow.h"
#include "lite/backends/arm/math/prior_box.h"
#include "lite/backends/arm/math/prior_box.h"
#include "lite/backends/arm/math/reduce_max.h"
#include "lite/backends/arm/math/reduce_max.h"
#include "lite/backends/arm/math/reduce_mean.h"
#include "lite/backends/arm/math/reduce_mean.h"
...
...
lite/backends/arm/math/pow
er
.cc
→
lite/backends/arm/math/pow.cc
浏览文件 @
664bb9a8
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#include "lite/backends/arm/math/power.h"
#include "lite/backends/arm/math/pow.h"
#include "lite/backends/arm/math/funcs.h"
#include "lite/backends/arm/math/funcs.h"
namespace
paddle
{
namespace
paddle
{
...
@@ -26,13 +27,13 @@ void power<float>(const float* din,
...
@@ -26,13 +27,13 @@ void power<float>(const float* din,
const
int
num
,
const
int
num
,
float
scale_
,
float
scale_
,
float
shift_
,
float
shift_
,
float
powe
r_
)
{
float
facto
r_
)
{
int
cnt
=
num
>>
4
;
int
cnt
=
num
>>
4
;
int
remain
=
num
%
16
;
int
remain
=
num
%
16
;
bool
_do_power
=
true
;
bool
_do_power
=
true
;
bool
_do_scale
=
true
;
bool
_do_scale
=
true
;
bool
_do_shift
=
true
;
bool
_do_shift
=
true
;
if
(
fabsf
(
powe
r_
-
1.
f
)
<
1e-6
f
)
{
if
(
fabsf
(
facto
r_
-
1.
f
)
<
1e-6
f
)
{
_do_power
=
false
;
_do_power
=
false
;
}
}
if
(
fabsf
(
scale_
-
1.
f
)
<
1e-6
f
)
{
if
(
fabsf
(
scale_
-
1.
f
)
<
1e-6
f
)
{
...
@@ -45,7 +46,7 @@ void power<float>(const float* din,
...
@@ -45,7 +46,7 @@ void power<float>(const float* din,
const
float
*
ptr_in
=
din
;
const
float
*
ptr_in
=
din
;
float32x4_t
vscale
=
vdupq_n_f32
(
scale_
);
float32x4_t
vscale
=
vdupq_n_f32
(
scale_
);
float32x4_t
vshift
=
vdupq_n_f32
(
shift_
);
float32x4_t
vshift
=
vdupq_n_f32
(
shift_
);
float32x4_t
vpower
=
vdupq_n_f32
(
powe
r_
);
float32x4_t
vpower
=
vdupq_n_f32
(
facto
r_
);
#pragma omp parallel for
#pragma omp parallel for
for
(
int
nums
=
0
;
nums
<
cnt
;
++
nums
)
{
for
(
int
nums
=
0
;
nums
<
cnt
;
++
nums
)
{
float32x4_t
vr0
=
vld1q_f32
(
ptr_in
);
float32x4_t
vr0
=
vld1q_f32
(
ptr_in
);
...
@@ -84,7 +85,7 @@ void power<float>(const float* din,
...
@@ -84,7 +85,7 @@ void power<float>(const float* din,
ptr_out
+=
4
;
ptr_out
+=
4
;
}
}
for
(
int
j
=
0
;
j
<
remain
;
++
j
)
{
for
(
int
j
=
0
;
j
<
remain
;
++
j
)
{
ptr_out
[
0
]
=
std
::
pow
((
ptr_in
[
0
]
*
scale_
+
shift_
),
powe
r_
);
ptr_out
[
0
]
=
std
::
pow
((
ptr_in
[
0
]
*
scale_
+
shift_
),
facto
r_
);
ptr_in
++
;
ptr_in
++
;
ptr_out
++
;
ptr_out
++
;
}
}
...
...
lite/backends/arm/math/pow
er
.h
→
lite/backends/arm/math/pow.h
浏览文件 @
664bb9a8
...
@@ -20,12 +20,12 @@ namespace arm {
...
@@ -20,12 +20,12 @@ namespace arm {
namespace
math
{
namespace
math
{
template
<
typename
T
>
template
<
typename
T
>
void
pow
er
(
const
T
*
din
,
void
pow
(
const
T
*
din
,
T
*
dout
,
T
*
dout
,
const
int
num
,
const
int
num
,
float
scale_
,
float
scale_
,
float
shift_
,
float
shift_
,
float
powe
r_
);
float
facto
r_
);
}
/* namespace math */
}
/* namespace math */
}
/* namespace arm */
}
/* namespace arm */
...
...
lite/kernels/arm/pow_compute.cc
浏览文件 @
664bb9a8
...
@@ -29,9 +29,7 @@ void PowCompute::Run() {
...
@@ -29,9 +29,7 @@ void PowCompute::Run() {
float
shift
=
0.0
;
float
shift
=
0.0
;
float
power
=
param
.
factor
;
float
power
=
param
.
factor
;
// fixme: update lite::arm::math::power if necessary, for scale and shift is
lite
::
arm
::
math
::
pow
(
// not used
lite
::
arm
::
math
::
power
(
x_data
,
output_data
,
x_dims
.
production
(),
scale
,
shift
,
power
);
x_data
,
output_data
,
x_dims
.
production
(),
scale
,
shift
,
power
);
}
}
...
...
lite/operators/CMakeLists.txt
浏览文件 @
664bb9a8
...
@@ -60,7 +60,6 @@ add_operator(sign_op extra SRCS sign_op.cc DEPS ${op_DEPS})
...
@@ -60,7 +60,6 @@ add_operator(sign_op extra SRCS sign_op.cc DEPS ${op_DEPS})
add_operator
(
negative_op extra SRCS negative_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
negative_op extra SRCS negative_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
crop_op extra SRCS crop_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
crop_op extra SRCS crop_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
assign_op extra SRCS assign_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
assign_op extra SRCS assign_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
power_op extra SRCS power_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
group_norm_op extra SRCS group_norm_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
group_norm_op extra SRCS group_norm_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
norm_op extra SRCS norm_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
norm_op extra SRCS norm_op.cc DEPS
${
op_DEPS
}
)
...
...
lite/operators/power_op.cc
已删除
100644 → 0
浏览文件 @
8205860e
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "lite/operators/power_op.h"
#include "lite/core/op_lite.h"
#include "lite/core/op_registry.h"
#include "lite/core/tensor.h"
namespace
paddle
{
namespace
lite
{
namespace
operators
{
bool
PowerOp
::
CheckShape
()
const
{
CHECK_OR_FALSE
(
param_
.
X
);
CHECK_OR_FALSE
(
param_
.
Out
);
return
true
;
}
bool
PowerOp
::
InferShapeImpl
()
const
{
param_
.
Out
->
Resize
(
param_
.
X
->
dims
());
return
true
;
}
bool
PowerOp
::
AttachImpl
(
const
cpp
::
OpDesc
&
op_desc
,
lite
::
Scope
*
scope
)
{
auto
X
=
op_desc
.
Input
(
"X"
).
front
();
auto
Out
=
op_desc
.
Output
(
"Out"
).
front
();
param_
.
X
=
scope
->
FindVar
(
X
)
->
GetMutable
<
lite
::
Tensor
>
();
param_
.
Out
=
scope
->
FindVar
(
Out
)
->
GetMutable
<
lite
::
Tensor
>
();
param_
.
scale
=
op_desc
.
GetAttr
<
float
>
(
"scale"
);
param_
.
shift
=
op_desc
.
GetAttr
<
float
>
(
"shift"
);
param_
.
power
=
op_desc
.
GetAttr
<
float
>
(
"power"
);
CHECK
(
param_
.
X
);
CHECK
(
param_
.
Out
);
return
true
;
}
}
/* namespace operators */
}
/* namespace lite */
}
/* namespace paddle */
REGISTER_LITE_OP
(
power
,
paddle
::
lite
::
operators
::
PowerOp
);
lite/operators/power_op.h
已删除
100644 → 0
浏览文件 @
8205860e
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <string>
#include <vector>
#include "lite/core/op_lite.h"
#include "lite/core/scope.h"
#include "lite/utils/all.h"
namespace
paddle
{
namespace
lite
{
namespace
operators
{
/**
* @deprecated There is NO power op in paddle fluid
*/
class
PowerOp
:
public
OpLite
{
public:
PowerOp
()
{}
explicit
PowerOp
(
const
std
::
string
&
op_type
)
:
OpLite
(
op_type
)
{}
bool
CheckShape
()
const
override
;
bool
InferShapeImpl
()
const
override
;
bool
AttachImpl
(
const
cpp
::
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
;
void
AttachKernel
(
KernelBase
*
kernel
)
override
{
kernel
->
SetParam
(
param_
);
}
std
::
string
DebugString
()
const
override
{
return
"power"
;
}
#ifdef LITE_WITH_PROFILE
void
GetOpRuntimeInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
input_shape
=
ch
->
DimToStr
(
param_
.
X
->
dims
());
ch
->
output_shape
=
ch
->
DimToStr
(
param_
.
Out
->
dims
());
// ch->remark = "";
ch
->
macs
=
param_
.
Out
->
numel
()
*
3.0
f
;
}
#endif
private:
mutable
PowerParam
param_
;
};
}
/* namespace operators */
}
/* namespace lite */
}
/* namespace paddle */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录