Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
dead5163
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看板
未验证
提交
dead5163
编写于
3月 07, 2020
作者:
X
xiebaiyuan
提交者:
GitHub
3月 07, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[LITE][OPENCL][Image] fix bias in depthwise3x3 and s1 ,test=develop (#3105)
上级
75be6936
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
29 addition
and
2 deletion
+29
-2
lite/kernels/opencl/conv_image_compute.cc
lite/kernels/opencl/conv_image_compute.cc
+29
-2
未找到文件。
lite/kernels/opencl/conv_image_compute.cc
浏览文件 @
dead5163
...
@@ -61,8 +61,6 @@ void ConvImageCompute::PrepareForRun() {
...
@@ -61,8 +61,6 @@ void ConvImageCompute::PrepareForRun() {
bool
stride_equal
=
stride_h
==
stride_w
;
bool
stride_equal
=
stride_h
==
stride_w
;
bool
dilation_equal
=
dilations
[
0
]
==
dilations
[
1
];
bool
dilation_equal
=
dilations
[
0
]
==
dilations
[
1
];
CHECK
(
pad_equal
&&
stride_equal
&&
dilation_equal
);
VLOG
(
3
)
<<
"Is relu fused? / "
<<
(
relu_fused
?
"Yes"
:
"No"
);
VLOG
(
3
)
<<
"Is relu fused? / "
<<
(
relu_fused
?
"Yes"
:
"No"
);
VLOG
(
3
)
<<
"groups:"
<<
groups
<<
" stride_h:"
<<
stride_h
VLOG
(
3
)
<<
"groups:"
<<
groups
<<
" stride_h:"
<<
stride_h
<<
" stride_w:"
<<
stride_w
<<
" pad_h:"
<<
pad_h
<<
" stride_w:"
<<
stride_w
<<
" pad_h:"
<<
pad_h
...
@@ -70,10 +68,18 @@ void ConvImageCompute::PrepareForRun() {
...
@@ -70,10 +68,18 @@ void ConvImageCompute::PrepareForRun() {
<<
" kernel_h:"
<<
kernel_h
;
<<
" kernel_h:"
<<
kernel_h
;
VLOG
(
3
)
<<
"x_dims:"
<<
x_dims
[
0
]
<<
" "
<<
x_dims
[
1
]
<<
" "
<<
x_dims
[
2
]
VLOG
(
3
)
<<
"x_dims:"
<<
x_dims
[
0
]
<<
" "
<<
x_dims
[
1
]
<<
" "
<<
x_dims
[
2
]
<<
" "
<<
x_dims
[
3
];
<<
" "
<<
x_dims
[
3
];
VLOG
(
3
)
<<
"dialtion:"
<<
dilations
[
0
]
<<
" "
<<
dilations
[
1
];
VLOG
(
3
)
<<
"output_dims:"
<<
output_dims
[
0
]
<<
" "
<<
output_dims
[
1
]
<<
" "
VLOG
(
3
)
<<
"output_dims:"
<<
output_dims
[
0
]
<<
" "
<<
output_dims
[
1
]
<<
" "
<<
output_dims
[
2
]
<<
" "
<<
output_dims
[
3
];
<<
output_dims
[
2
]
<<
" "
<<
output_dims
[
3
];
VLOG
(
3
)
<<
"filter_dims:"
<<
filter_dims
[
0
]
<<
" "
<<
filter_dims
[
1
]
<<
" "
VLOG
(
3
)
<<
"filter_dims:"
<<
filter_dims
[
0
]
<<
" "
<<
filter_dims
[
1
]
<<
" "
<<
filter_dims
[
2
]
<<
" "
<<
filter_dims
[
3
];
<<
filter_dims
[
2
]
<<
" "
<<
filter_dims
[
3
];
VLOG
(
3
)
<<
"pad_equal:"
<<
pad_equal
;
VLOG
(
3
)
<<
"stride_equal:"
<<
stride_equal
;
VLOG
(
3
)
<<
"dilation_equal:"
<<
dilation_equal
;
VLOG
(
3
)
<<
"padding :"
<<
paddings
[
0
]
<<
" "
<<
paddings
[
1
]
<<
" "
<<
paddings
[
2
]
<<
" "
<<
paddings
[
3
];
CHECK
(
pad_equal
&&
stride_equal
&&
dilation_equal
);
if
(
kernel_h
==
1
&&
kernel_w
==
1
)
{
if
(
kernel_h
==
1
&&
kernel_w
==
1
)
{
// conv2d_1x1
// conv2d_1x1
if
(
param
.
x
->
dims
()[
1
]
%
4
==
0
)
{
if
(
param
.
x
->
dims
()[
1
]
%
4
==
0
)
{
...
@@ -879,6 +885,17 @@ void ConvImageCompute::DepthwiseConv2d3x3s1() {
...
@@ -879,6 +885,17 @@ void ConvImageCompute::DepthwiseConv2d3x3s1() {
CL_CHECK_FATAL
(
status
);
CL_CHECK_FATAL
(
status
);
status
=
kernel
.
setArg
(
++
arg_idx
,
*
filter_img
);
status
=
kernel
.
setArg
(
++
arg_idx
,
*
filter_img
);
CL_CHECK_FATAL
(
status
);
CL_CHECK_FATAL
(
status
);
const
bool
has_bias
=
param
.
bias
!=
nullptr
;
const
bool
is_element_wise_bias
=
has_bias
&&
param
.
output
->
dims
()
==
param
.
bias
->
dims
();
const
cl
::
Image2D
*
bias_image
=
nullptr
;
if
(
has_bias
)
{
bias_image
=
bias_gpu_image_
.
data
<
half_t
,
cl
::
Image2D
>
();
VLOG
(
4
)
<<
"set bias_image: "
;
status
=
kernel
.
setArg
(
++
arg_idx
,
*
bias_image
);
CL_CHECK_FATAL
(
status
);
}
status
=
kernel
.
setArg
(
++
arg_idx
,
*
output_img
);
status
=
kernel
.
setArg
(
++
arg_idx
,
*
output_img
);
CL_CHECK_FATAL
(
status
);
CL_CHECK_FATAL
(
status
);
status
=
kernel
.
setArg
(
++
arg_idx
,
static_cast
<
const
int
>
(
strides
[
0
]));
status
=
kernel
.
setArg
(
++
arg_idx
,
static_cast
<
const
int
>
(
strides
[
0
]));
...
@@ -970,6 +987,16 @@ void ConvImageCompute::DepthwiseConv2d3x3() {
...
@@ -970,6 +987,16 @@ void ConvImageCompute::DepthwiseConv2d3x3() {
CL_CHECK_FATAL
(
status
);
CL_CHECK_FATAL
(
status
);
status
=
kernel
.
setArg
(
++
arg_idx
,
*
filter_img
);
status
=
kernel
.
setArg
(
++
arg_idx
,
*
filter_img
);
CL_CHECK_FATAL
(
status
);
CL_CHECK_FATAL
(
status
);
const
bool
has_bias
=
param
.
bias
!=
nullptr
;
const
bool
is_element_wise_bias
=
has_bias
&&
param
.
output
->
dims
()
==
param
.
bias
->
dims
();
const
cl
::
Image2D
*
bias_image
=
nullptr
;
if
(
has_bias
)
{
bias_image
=
bias_gpu_image_
.
data
<
half_t
,
cl
::
Image2D
>
();
VLOG
(
4
)
<<
"set bias_image: "
;
status
=
kernel
.
setArg
(
++
arg_idx
,
*
bias_image
);
CL_CHECK_FATAL
(
status
);
}
status
=
kernel
.
setArg
(
++
arg_idx
,
*
output_img
);
status
=
kernel
.
setArg
(
++
arg_idx
,
*
output_img
);
CL_CHECK_FATAL
(
status
);
CL_CHECK_FATAL
(
status
);
status
=
kernel
.
setArg
(
++
arg_idx
,
static_cast
<
const
int
>
(
strides
[
0
]));
status
=
kernel
.
setArg
(
++
arg_idx
,
static_cast
<
const
int
>
(
strides
[
0
]));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录