Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
2fbf8db5
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看板
提交
2fbf8db5
编写于
10月 16, 2018
作者:
D
dolphin8
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix kernel
上级
8c1959b9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
5 deletion
+19
-5
src/operators/kernel/cl/cl_kernel/relu.cl
src/operators/kernel/cl/cl_kernel/relu.cl
+13
-1
src/operators/kernel/cl/cl_kernel/reshape.cl
src/operators/kernel/cl/cl_kernel/reshape.cl
+6
-4
未找到文件。
src/operators/kernel/cl/cl_kernel/relu.cl
浏览文件 @
2fbf8db5
/*
Copyright
(
c
)
2018
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
OPENCL
EXTENSION
cl_khr_fp16
:
enable
#
pragma
OPENCL
EXTENSION
cl_khr_fp16
:
enable
__kernel
void
relu
(
__read_only
image2d_t
input,
__kernel
void
relu
(
__read_only
image2d_t
input,
...
@@ -12,6 +24,6 @@ __kernel void relu(__read_only image2d_t input,
...
@@ -12,6 +24,6 @@ __kernel void relu(__read_only image2d_t input,
CLK_FILTER_NEAREST
;
CLK_FILTER_NEAREST
;
half4
in
=
read_imageh
(
input,
sampler,
(
int2
)(
x,
y
))
;
half4
in
=
read_imageh
(
input,
sampler,
(
int2
)(
x,
y
))
;
in
=
max
((
half4
)(
0.0
)
,
in
)
;
in
=
max
((
half4
)(
0.0
f,0.0f,0.0f,0.0f
)
,
in
)
;
write_imageh
(
output,
(
int2
)(
x,
y
)
,
in
)
;
write_imageh
(
output,
(
int2
)(
x,
y
)
,
in
)
;
}
}
\ No newline at end of file
src/operators/kernel/cl/cl_kernel/reshape.cl
浏览文件 @
2fbf8db5
...
@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.
*/
#
pragma
OPENCL
EXTENSION
cl_khr_fp16
:
enable
__kernel
void
reshape
(
__read_only
image2d_t
input,
__kernel
void
reshape
(
__read_only
image2d_t
input,
__write_only
image2d_t
output,
__write_only
image2d_t
output,
__private
const
int
d0,
__private
const
int
d0,
...
@@ -36,14 +38,14 @@ __kernel void reshape(__read_only image2d_t input,
...
@@ -36,14 +38,14 @@ __kernel void reshape(__read_only image2d_t input,
int
t
=
obx
*
4
+
i
;
int
t
=
obx
*
4
+
i
;
if
(
t
>
x1
)
break
;
if
(
t
>
x1
)
break
;
int
oindex
=
oby
*
x1
*
x2
*
x3
+
t
*
x2
*
x3
+
ox
*
x3
+
oy
;
int
oindex
=
oby
*
x1
*
x2
*
x3
+
t
*
x2
*
x3
+
ox
*
x3
+
oy
;
int
i0,
i1,
i2,
i3
;
int
i3
=
oindex
%
d3
; oindex /= d3;
int
i3
=
oindex
%
d3
; oindex /= d3;
int
i2
=
oindex
%
d2
; oindex /= d2;
int
i2
=
oindex
%
d2
; oindex /= d2;
int
i1
=
oindex
%
d1
; oindex /= d1;
int
i1
=
oindex
%
d1
; oindex /= d1;
int
i0
=
oindex
;
int
i0
=
oindex
;
int
ix
=
(
i1
/
4
)
*
d3
+
i3
;
int
ix
=
(
i1
/
4
)
*
d3
+
i3
;
int
iy
=
i0
*
d2
+
i2
;
int
iy
=
i0
*
d2
+
i2
;
r[i]
=
read_imageh
(
input,
sampler,
int2
(
ix,
iy
))
[i1%4]
;
half4
p
=
read_imageh
(
input,
sampler,
(
int2
)(
ix,
iy
))
;
((
half*
)
&r
)
[i]
=
((
half*
)
&p
)
[i1%4]
;
}
}
write_imageh
(
output,
int2
(
x,
y
)
,
r
)
;
write_imageh
(
output,
(
int2
)(
x,
y
)
,
r
)
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录