Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
bfadcc5e
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看板
提交
bfadcc5e
编写于
11月 06, 2018
作者:
Z
zhangyang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/develop' into develop
上级
34a7a0e0
54b6fd3f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
28 deletion
+32
-28
src/operators/math/depthwise_conv_3x3.cpp
src/operators/math/depthwise_conv_3x3.cpp
+32
-28
未找到文件。
src/operators/math/depthwise_conv_3x3.cpp
浏览文件 @
bfadcc5e
...
...
@@ -1275,7 +1275,8 @@ void DepthwiseConv3x3s2p1v2(const Tensor *input, const Tensor *filter,
const
int
inhxw
=
in_h
*
in_w
;
const
int
outhxw
=
out_h
*
out_w
;
/// todo : fix if_pad when w != h
const
int
if_pad
=
in_w
-
1
==
(
out_w
-
1
)
*
2
?
1
:
0
;
const
int
if_pad_r
=
in_w
-
1
==
(
out_w
-
1
)
*
2
?
1
:
0
;
const
int
if_pad_b
=
in_h
-
1
==
(
out_h
-
1
)
*
2
?
1
:
0
;
const
int
batch_size
=
static_cast
<
int
>
(
input
->
dims
()[
0
]);
const
int
c
=
static_cast
<
int
>
(
input
->
dims
()[
1
]);
const
float
*
input_row_ptr
;
...
...
@@ -1366,7 +1367,7 @@ void DepthwiseConv3x3s2p1v2(const Tensor *input, const Tensor *filter,
elewise_res0
=
vmlaq_n_f32
(
elewise_res0
,
input_buff_mid
.
val
[
0
],
w10
);
elewise_res2
=
vmlaq_n_f32
(
elewise_res2
,
input_buff_mid
.
val
[
0
],
w12
);
if
(
!
if_pad
)
{
if
(
!
if_pad
_b
)
{
elewise_res1
=
vmlaq_n_f32
(
elewise_res1
,
input_buff_bottom
[
w4
].
val
[
1
],
w21
);
elewise_res0
=
...
...
@@ -1401,8 +1402,8 @@ void DepthwiseConv3x3s2p1v2(const Tensor *input, const Tensor *filter,
w10
*
input_const
[
out2in_mid
-
1
]
+
w11
*
input_const
[
out2in_mid
]
+
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
]
+
(
1
-
if_pad
)
*
(
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad
_r
)
*
(
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
out2in_mid
=
(
out_h
-
1
)
*
2
*
in_w
;
...
...
@@ -1410,19 +1411,20 @@ void DepthwiseConv3x3s2p1v2(const Tensor *input, const Tensor *filter,
w01
*
input_const
[
out2in_mid
-
in_w
]
+
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w11
*
input_const
[
out2in_mid
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
(
1
-
if_pad
)
*
(
w21
*
input_const
[
out2in_mid
+
in_w
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad
_b
)
*
(
w21
*
input_const
[
out2in_mid
+
in_w
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
out2in_mid
=
(
out_h
-
1
)
*
2
*
in_w
+
(
out_w
-
1
)
*
2
;
output_data_tmp
[
out_h
*
out_w
-
1
]
=
w00
*
input_const
[
out2in_mid
-
in_w
-
1
]
+
w01
*
input_const
[
out2in_mid
-
in_w
]
+
w10
*
input_const
[
out2in_mid
-
1
]
+
w11
*
input_const
[
out2in_mid
]
+
(
1
-
if_pad
)
*
(
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
]
+
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad_r
)
*
(
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
])
+
(
1
-
if_pad_b
)
*
(
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
])
+
(
1
-
if_pad_r
)
*
(
1
-
if_pad_b
)
*
w22
*
input_const
[
out2in_mid
+
in_w
+
1
];
if
(
if_bias
)
{
output_data_tmp
[
0
]
+=
bias_data
[
j
];
output_data_tmp
[
out_w
-
1
]
+=
bias_data
[
j
];
...
...
@@ -1445,9 +1447,9 @@ void DepthwiseConv3x3s2p1v2(const Tensor *input, const Tensor *filter,
w10
*
input_const
[
out2in_mid
-
1
]
+
w11
*
input_const
[
out2in_mid
]
+
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
]
+
(
1
-
if_pad
)
*
(
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad
_r
)
*
(
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
if
(
if_bias
)
{
output_data_tmp
[
i
*
out_w
]
+=
bias_data
[
j
];
output_data_tmp
[
i
*
out_w
+
out_w
-
1
]
+=
bias_data
[
j
];
...
...
@@ -1662,7 +1664,8 @@ void DepthwiseConvAddBNRelu3x3s2p1v2(const Tensor *input, const Tensor *filter,
const
int
inhxw
=
in_h
*
in_w
;
const
int
outhxw
=
out_h
*
out_w
;
/// todo : fix if_pad when w != h
const
int
if_pad
=
in_w
-
1
==
(
out_w
-
1
)
*
2
?
1
:
0
;
const
int
if_pad_r
=
in_w
-
1
==
(
out_w
-
1
)
*
2
?
1
:
0
;
const
int
if_pad_b
=
in_h
-
1
==
(
out_h
-
1
)
*
2
?
1
:
0
;
const
int
batch_size
=
static_cast
<
int
>
(
input
->
dims
()[
0
]);
const
int
c
=
static_cast
<
int
>
(
input
->
dims
()[
1
]);
const
int
w_times
=
(
out_w
-
2
)
/
3
;
...
...
@@ -1756,7 +1759,7 @@ void DepthwiseConvAddBNRelu3x3s2p1v2(const Tensor *input, const Tensor *filter,
elewise_res0
=
vmlaq_n_f32
(
elewise_res0
,
input_buff_mid
.
val
[
0
],
w10
);
elewise_res2
=
vmlaq_n_f32
(
elewise_res2
,
input_buff_mid
.
val
[
0
],
w12
);
if
(
!
if_pad
)
{
if
(
!
if_pad
_b
)
{
elewise_res1
=
vmlaq_n_f32
(
elewise_res1
,
input_buff_bottom
[
w4
].
val
[
1
],
w21
);
elewise_res0
=
...
...
@@ -1796,8 +1799,8 @@ void DepthwiseConvAddBNRelu3x3s2p1v2(const Tensor *input, const Tensor *filter,
w10
*
input_const
[
out2in_mid
-
1
]
+
w11
*
input_const
[
out2in_mid
]
+
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
]
+
(
1
-
if_pad
)
*
(
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad
_r
)
*
(
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
out2in_mid
=
(
out_h
-
1
)
*
2
*
in_w
;
...
...
@@ -1805,19 +1808,20 @@ void DepthwiseConvAddBNRelu3x3s2p1v2(const Tensor *input, const Tensor *filter,
w01
*
input_const
[
out2in_mid
-
in_w
]
+
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w11
*
input_const
[
out2in_mid
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
(
1
-
if_pad
)
*
(
w21
*
input_const
[
out2in_mid
+
in_w
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad
_b
)
*
(
w21
*
input_const
[
out2in_mid
+
in_w
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
out2in_mid
=
(
out_h
-
1
)
*
2
*
in_w
+
(
out_w
-
1
)
*
2
;
output_data_tmp
[
out_h
*
out_w
-
1
]
=
w00
*
input_const
[
out2in_mid
-
in_w
-
1
]
+
w01
*
input_const
[
out2in_mid
-
in_w
]
+
w10
*
input_const
[
out2in_mid
-
1
]
+
w11
*
input_const
[
out2in_mid
]
+
(
1
-
if_pad
)
*
(
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
]
+
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad_r
)
*
(
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
])
+
(
1
-
if_pad_b
)
*
(
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
])
+
(
1
-
if_pad_r
)
*
(
1
-
if_pad_b
)
*
w22
*
input_const
[
out2in_mid
+
in_w
+
1
];
output_data_tmp
[
0
]
=
output_data_tmp
[
0
]
*
newscale_data
[
j
]
+
newbias_data
[
j
];
output_data_tmp
[
out_w
-
1
]
=
...
...
@@ -1857,9 +1861,9 @@ void DepthwiseConvAddBNRelu3x3s2p1v2(const Tensor *input, const Tensor *filter,
w10
*
input_const
[
out2in_mid
-
1
]
+
w11
*
input_const
[
out2in_mid
]
+
w20
*
input_const
[
out2in_mid
+
in_w
-
1
]
+
w21
*
input_const
[
out2in_mid
+
in_w
]
+
(
1
-
if_pad
)
*
(
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
(
1
-
if_pad
_r
)
*
(
w02
*
input_const
[
out2in_mid
-
in_w
+
1
]
+
w12
*
input_const
[
out2in_mid
+
1
]
+
w22
*
input_const
[
out2in_mid
+
in_w
+
1
]);
output_data_tmp
[
i
*
out_w
]
=
output_data_tmp
[
i
*
out_w
]
*
newscale_data
[
j
]
+
newbias_data
[
j
];
output_data_tmp
[
i
*
out_w
+
out_w
-
1
]
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录