Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f882f9fd
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,发现更多精彩内容 >>
未验证
提交
f882f9fd
编写于
4月 24, 2020
作者:
X
xiebaiyuan
提交者:
GitHub
4月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bilinear_interp build err on mali,test=develop (#3474)
上级
a6336543
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
55 deletion
+60
-55
mobile/src/operators/kernel/cl/cl_kernel/bilinear_interp_kernel.cl
...c/operators/kernel/cl/cl_kernel/bilinear_interp_kernel.cl
+60
-55
未找到文件。
mobile/src/operators/kernel/cl/cl_kernel/bilinear_interp_kernel.cl
浏览文件 @
f882f9fd
...
...
@@ -13,70 +13,75 @@ See the License for the specific language governing permissions and
limitations
under
the
License.
*/
#
pragma
OPENCL
EXTENSION
cl_khr_fp16
:
enable
__kernel
void
bilinear_interp
(
__read_only
image2d_t
input,
__write_only
image2d_t
output,
__private
const
float
scale_h,
__private
const
float
scale_w,
__private
const
int
in_dims_h,
__private
const
int
out_dims_h,
__private
const
int
in_dims_w,
__private
const
int
out_dims_w,
__private
const
float
align_delta
)
{
const
int
c
=
get_global_id
(
0
)
;
const
int
w
=
get_global_id
(
1
)
;
const
int
nh
=
get_global_id
(
2
)
;
__kernel
void
bilinear_interp
(
__read_only
image2d_t
input,
__write_only
image2d_t
output,
__private
const
float
scale_h,
__private
const
float
scale_w,
__private
const
int
in_dims_h,
__private
const
int
out_dims_h,
__private
const
int
in_dims_w,
__private
const
int
out_dims_w,
__private
const
float
align_delta
)
{
const
int
c
=
get_global_id
(
0
)
;
const
int
w
=
get_global_id
(
1
)
;
const
int
nh
=
get_global_id
(
2
)
;
int2
output_pos
;
output_pos.x
=
c
*
out_dims_w
+
w
;
output_pos.y
=
nh
;
int2
output_pos
;
output_pos.x
=
c
*
out_dims_w
+
w
;
output_pos.y
=
nh
;
//
calculate
center
pixel
's
pos
int
out_n
=
nh
/
out_dims_h
;
int
out_h
=
nh
%
out_dims_h
;
float
center_w
=
(
w
+
align_delta
)
*
scale_w
-
align_delta
;
float
center_h
=
(
out_h
+
align_delta
)
*
scale_h
-
align_delta
;
//
calculate
center
pixel
's
pos
int
out_n
=
nh
/
out_dims_h
;
int
out_h
=
nh
%
out_dims_h
;
float
center_w
=
(
w
+
align_delta
)
*
scale_w
-
align_delta
;
float
center_h
=
(
out_h
+
align_delta
)
*
scale_h
-
align_delta
;
int
floor_w
=
(
int
)
center_w
;
int
floor_h
=
(
int
)
center_h
;
int
ceil_w
=
floor_w
+
1
;
int
ceil_h
=
floor_h
+
1
;
int
floor_w
=
(
int
)
center_w
;
int
floor_h
=
(
int
)
center_h
;
int
ceil_w
=
floor_w
+
1
;
int
ceil_h
=
floor_h
+
1
;
if
(
ceil_w
>
in_dims_w
)
{
ceil_w
=
floor_w
;
}
if
(
ceil_h
>
in_dims_h
)
{
ceil_h
=
floor_h
;
}
float
wight0_w
=
center_w
-
floor_w
;
float
wight0_h
=
center_h
-
floor_h
;
float
wight1_w
=
1.0
-
wight0_w
;
float
wight1_h
=
1.0
-
wight0_h
;
if
(
ceil_w
>
in_dims_w
)
{
ceil_w
=
floor_w
;
}
if
(
ceil_h
>
in_dims_h
)
{
ceil_h
=
floor_h
;
}
float
wight0_w
=
center_w
-
floor_w
;
float
wight0_h
=
center_h
-
floor_h
;
float
wight1_w
=
1.0f
-
wight0_w
;
float
wight1_h
=
1.0f
-
wight0_h
;
const
sampler_t
sampler
=
CLK_NORMALIZED_COORDS_TRUE
| CLK_ADDRESS_CLAMP |
CLK_FILTER_NEAREST
;
const
sampler_t
sampler
=
CLK_NORMALIZED_COORDS_TRUE
| CLK_ADDRESS_CLAMP |
CLK_FILTER_NEAREST
;
//
get
left
up
pixel
data
int2
left_up
;
left_up.x
=
c
*
in_dims_w
+
floor_w
;
left_up.y
=
out_n
*
in_dims_h
+
ceil_h
;
half4
left_up_data
=
read_imageh
(
input,
sampler,
left_up
)
;
//
get
left
up
pixel
data
int2
left_up
;
left_up.x
=
c
*
in_dims_w
+
floor_w
;
left_up.y
=
out_n
*
in_dims_h
+
ceil_h
;
half4
left_up_data
=
read_imageh
(
input,
sampler,
left_up
)
;
//
get
left
down
pixel
data
int2
left_down
;
left_down.x
=
c
*
in_dims_w
+
floor_w
;
left_down.y
=
out_n
*
in_dims_h
+
floor_h
;
half4
left_down_data
=
read_imageh
(
input,
sampler,
left_down
)
;
//
get
left
down
pixel
data
int2
left_down
;
left_down.x
=
c
*
in_dims_w
+
floor_w
;
left_down.y
=
out_n
*
in_dims_h
+
floor_h
;
half4
left_down_data
=
read_imageh
(
input,
sampler,
left_down
)
;
//
get
right
up
pixel
data
int2
right_up
;
right_up.x
=
c
*
in_dims_w
+
ceil_w
;
right_up.y
=
out_n
*
in_dims_h
+
ceil_h
;
half4
right_up_data
=
read_imageh
(
input,
sampler,
right_up
)
;
//
get
right
up
pixel
data
int2
right_up
;
right_up.x
=
c
*
in_dims_w
+
ceil_w
;
right_up.y
=
out_n
*
in_dims_h
+
ceil_h
;
half4
right_up_data
=
read_imageh
(
input,
sampler,
right_up
)
;
//
get
right
down
pixel
's
data
int2
right_down
;
right_down.x
=
c
*
in_dims_w
+
ceil_w
;
right_down.y
=
out_n
*
in_dims_h
+
floor_h
;
half4
right_down_data
=
read_imageh
(
input,
sampler,
right_down
)
;
//
get
right
down
pixel
's
data
int2
right_down
;
right_down.x
=
c
*
in_dims_w
+
ceil_w
;
right_down.y
=
out_n
*
in_dims_h
+
floor_h
;
half4
right_down_data
=
read_imageh
(
input,
sampler,
right_down
)
;
//
calculate
output
data
half4
data
=
(
left_down_data
*
wight1_w
+
right_down_data
*
wight0_w
)
*
wight1_h
+
(
left_up_data
*
wight1_w
+
right_up_data
*
wight0_w
)
*
wight0_h
;
//
calculate
output
data
half4
data
=
(
left_down_data
*
(
half
)
wight1_w
+
right_down_data
*
(
half
)
wight0_w
)
*
(
half
)
wight1_h
+
(
left_up_data
*
(
half
)
wight1_w
+
right_up_data
*
(
half
)
wight0_w
)
*
(
half
)
wight0_h
;
write_imageh
(
output,
output_pos,
data
)
;
write_imageh
(
output,
output_pos,
data
)
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录