Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
9a09cf28
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
338
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看板
提交
9a09cf28
编写于
8月 17, 2020
作者:
C
chenjiaoAngel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix conv_dw choose kernel method
上级
b0fe17e4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
7 deletion
+11
-7
lite/backends/arm/math/conv_impl.cc
lite/backends/arm/math/conv_impl.cc
+5
-3
lite/kernels/arm/conv_depthwise.cc
lite/kernels/arm/conv_depthwise.cc
+6
-4
未找到文件。
lite/backends/arm/math/conv_impl.cc
浏览文件 @
9a09cf28
...
@@ -619,9 +619,10 @@ void conv_depthwise_3x3_fp32(const void* din,
...
@@ -619,9 +619,10 @@ void conv_depthwise_3x3_fp32(const void* din,
int
stride
=
param
.
strides
[
1
];
int
stride
=
param
.
strides
[
1
];
int
pad
=
pad_w
;
int
pad
=
pad_w
;
bool
flag_bias
=
param
.
bias
!=
nullptr
;
bool
flag_bias
=
param
.
bias
!=
nullptr
;
bool
ch_four
=
ch_in
<=
4
*
w_in
;
bool
pads_less
=
((
paddings
[
1
]
<
2
)
&&
(
paddings
[
3
]
<
2
));
bool
pads_less
=
((
paddings
[
1
]
<
2
)
&&
(
paddings
[
3
]
<
2
));
if
(
stride
==
1
)
{
if
(
stride
==
1
)
{
if
(
pads_less
&&
(
pad_h
==
pad_w
)
&&
(
pad
<
2
))
{
// support pad = [0, 1]
if
(
ch_four
&&
pads_less
&&
(
pad_h
==
pad_w
)
&&
(
pad
<
2
))
{
// support pad = [0, 1]
conv_depthwise_3x3s1_fp32
(
reinterpret_cast
<
const
float
*>
(
din
),
conv_depthwise_3x3s1_fp32
(
reinterpret_cast
<
const
float
*>
(
din
),
reinterpret_cast
<
float
*>
(
dout
),
reinterpret_cast
<
float
*>
(
dout
),
num
,
num
,
...
@@ -676,7 +677,7 @@ void conv_depthwise_3x3_fp32(const void* din,
...
@@ -676,7 +677,7 @@ void conv_depthwise_3x3_fp32(const void* din,
#endif
#endif
}
}
}
else
if
(
stride
==
2
)
{
}
else
if
(
stride
==
2
)
{
if
(
pads_less
&&
pad_h
==
pad_w
&&
(
pad
<
2
))
{
// support pad = [0, 1]
if
(
ch_four
&&
pads_less
&&
pad_h
==
pad_w
&&
(
pad
<
2
))
{
// support pad = [0, 1]
conv_depthwise_3x3s2_fp32
(
reinterpret_cast
<
const
float
*>
(
din
),
conv_depthwise_3x3s2_fp32
(
reinterpret_cast
<
const
float
*>
(
din
),
reinterpret_cast
<
float
*>
(
dout
),
reinterpret_cast
<
float
*>
(
dout
),
num
,
num
,
...
@@ -734,6 +735,7 @@ void conv_depthwise_5x5_fp32(const void* din,
...
@@ -734,6 +735,7 @@ void conv_depthwise_5x5_fp32(const void* din,
int
stride
=
param
.
strides
[
1
];
int
stride
=
param
.
strides
[
1
];
bool
flag_relu
=
param
.
fuse_relu
;
bool
flag_relu
=
param
.
fuse_relu
;
bool
flag_bias
=
param
.
bias
!=
nullptr
;
bool
flag_bias
=
param
.
bias
!=
nullptr
;
bool
ch_four
=
ch_in
>
4
*
w_in
;
ctx
->
ExtendWorkspace
((
w_in
+
w_out
)
*
sizeof
(
float
));
ctx
->
ExtendWorkspace
((
w_in
+
w_out
)
*
sizeof
(
float
));
bool
flag_act
=
act_param
.
has_active
;
bool
flag_act
=
act_param
.
has_active
;
if
(
stride
==
2
)
{
if
(
stride
==
2
)
{
...
@@ -752,7 +754,7 @@ void conv_depthwise_5x5_fp32(const void* din,
...
@@ -752,7 +754,7 @@ void conv_depthwise_5x5_fp32(const void* din,
act_param
,
act_param
,
ctx
);
ctx
);
}
else
if
(
stride
==
1
)
{
}
else
if
(
stride
==
1
)
{
if
(
h_in
<
5
||
w_in
<
5
)
{
if
(
ch_four
||
h_in
<
5
||
w_in
<
5
)
{
conv_depthwise_5x5s1_fp32
(
reinterpret_cast
<
float
*>
(
dout
),
conv_depthwise_5x5s1_fp32
(
reinterpret_cast
<
float
*>
(
dout
),
reinterpret_cast
<
const
float
*>
(
din
),
reinterpret_cast
<
const
float
*>
(
din
),
reinterpret_cast
<
const
float
*>
(
weights
),
reinterpret_cast
<
const
float
*>
(
weights
),
...
...
lite/kernels/arm/conv_depthwise.cc
浏览文件 @
9a09cf28
...
@@ -28,12 +28,16 @@ void DepthwiseConv<PRECISION(kFloat), PRECISION(kFloat)>::PrepareForRun() {
...
@@ -28,12 +28,16 @@ void DepthwiseConv<PRECISION(kFloat), PRECISION(kFloat)>::PrepareForRun() {
auto
&
ctx
=
this
->
ctx_
->
template
As
<
ARMContext
>();
auto
&
ctx
=
this
->
ctx_
->
template
As
<
ARMContext
>();
auto
w_dims
=
param
.
filter
->
dims
();
auto
w_dims
=
param
.
filter
->
dims
();
auto
kw
=
w_dims
[
3
];
auto
kw
=
w_dims
[
3
];
auto
channel
=
w_dims
[
0
];
auto
hin
=
param
.
x
->
dims
()[
2
];
auto
win
=
param
.
x
->
dims
()[
3
];
auto
paddings
=
*
param
.
paddings
;
auto
paddings
=
*
param
.
paddings
;
bool
ch_four
=
channel
<=
4
*
win
;
// select dw conv kernel
// select dw conv kernel
if
(
kw
==
3
)
{
if
(
kw
==
3
)
{
// VLOG(5) << "invoke 3x3 dw conv fp32";
// VLOG(5) << "invoke 3x3 dw conv fp32";
bool
pads_less
=
((
paddings
[
1
]
<
2
)
&&
(
paddings
[
3
]
<
2
));
bool
pads_less
=
((
paddings
[
1
]
<
2
)
&&
(
paddings
[
3
]
<
2
));
if
(
pads_less
&&
paddings
[
0
]
==
paddings
[
2
]
&&
if
(
ch_four
&&
pads_less
&&
paddings
[
0
]
==
paddings
[
2
]
&&
(
paddings
[
0
]
==
0
||
paddings
[
0
]
==
1
))
{
(
paddings
[
0
]
==
0
||
paddings
[
0
]
==
1
))
{
flag_trans_weights_
=
false
;
flag_trans_weights_
=
false
;
}
else
{
}
else
{
...
@@ -56,9 +60,7 @@ void DepthwiseConv<PRECISION(kFloat), PRECISION(kFloat)>::PrepareForRun() {
...
@@ -56,9 +60,7 @@ void DepthwiseConv<PRECISION(kFloat), PRECISION(kFloat)>::PrepareForRun() {
}
else
if
(
kw
==
5
)
{
}
else
if
(
kw
==
5
)
{
// VLOG(5) << "invoke 5x5 dw conv fp32";
// VLOG(5) << "invoke 5x5 dw conv fp32";
auto
strides
=
param
.
strides
;
auto
strides
=
param
.
strides
;
auto
hin
=
param
.
x
->
dims
()[
2
];
if
(
ch_four
&&
win
>=
kw
&&
hin
>=
kw
&&
(
strides
[
0
]
==
1
&&
strides
[
1
]
==
1
))
{
auto
win
=
param
.
x
->
dims
()[
3
];
if
(
win
>=
kw
&&
hin
>=
kw
&&
(
strides
[
0
]
==
1
&&
strides
[
1
]
==
1
))
{
flag_trans_weights_
=
false
;
flag_trans_weights_
=
false
;
impl_
=
lite
::
arm
::
math
::
conv_depthwise_5x5_fp32
;
impl_
=
lite
::
arm
::
math
::
conv_depthwise_5x5_fp32
;
#ifdef LITE_WITH_PROFILE
#ifdef LITE_WITH_PROFILE
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录