Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
e81515d3
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看板
提交
e81515d3
编写于
10月 16, 2018
作者:
Y
yangfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
repair bug of softmax op kernel
上级
82f9487b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
18 deletion
+32
-18
src/framework/cl/cl_helper.h
src/framework/cl/cl_helper.h
+11
-0
src/framework/executor.cpp
src/framework/executor.cpp
+1
-1
src/operators/kernel/cl/relu_kernel.cpp
src/operators/kernel/cl/relu_kernel.cpp
+12
-12
src/operators/kernel/cl/softmax_kernel.cpp
src/operators/kernel/cl/softmax_kernel.cpp
+8
-5
未找到文件。
src/framework/cl/cl_helper.h
浏览文件 @
e81515d3
...
@@ -64,6 +64,17 @@ class CLHelper {
...
@@ -64,6 +64,17 @@ class CLHelper {
auto
work_size_2
=
n
*
h
;
auto
work_size_2
=
n
*
h
;
return
{
work_size_0
,
work_size_1
,
work_size_2
};
}
else
if
(
image_dim
.
size
()
==
2
){
auto
image_width
=
image
.
ImageWidth
();
auto
work_size_0
=
image_width
/
image_dim
[
1
];
auto
work_size_1
=
image_dim
[
1
];
auto
work_size_2
=
image_dim
[
0
];
return
{
work_size_0
,
work_size_1
,
work_size_2
};
return
{
work_size_0
,
work_size_1
,
work_size_2
};
}
}
PADDLE_MOBILE_THROW_EXCEPTION
(
"not support this dim, need imp"
);
PADDLE_MOBILE_THROW_EXCEPTION
(
"not support this dim, need imp"
);
...
...
src/framework/executor.cpp
浏览文件 @
e81515d3
...
@@ -37,7 +37,7 @@ limitations under the License. */
...
@@ -37,7 +37,7 @@ limitations under the License. */
#include "framework/cl/cl_image.h"
#include "framework/cl/cl_image.h"
#endif
#endif
int
debug_to
=
4
;
int
debug_to
=
115
;
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
framework
{
namespace
framework
{
...
...
src/operators/kernel/cl/relu_kernel.cpp
浏览文件 @
e81515d3
...
@@ -20,23 +20,23 @@ namespace operators {
...
@@ -20,23 +20,23 @@ namespace operators {
template
<
>
template
<
>
bool
ReluKernel
<
GPU_CL
,
float
>::
Init
(
ReluParam
<
GPU_CL
>*
param
)
{
bool
ReluKernel
<
GPU_CL
,
float
>::
Init
(
ReluParam
<
GPU_CL
>*
param
)
{
this
->
cl_helper_
.
AddKernel
(
"relu"
,
"relu.cl"
);
//
this->cl_helper_.AddKernel("relu", "relu.cl");
return
true
;
return
true
;
}
}
template
<
>
template
<
>
void
ReluKernel
<
GPU_CL
,
float
>::
Compute
(
const
ReluParam
<
GPU_CL
>&
param
)
{
void
ReluKernel
<
GPU_CL
,
float
>::
Compute
(
const
ReluParam
<
GPU_CL
>&
param
)
{
auto
kernel
=
this
->
cl_helper_
.
KernelAt
(
0
);
//
auto kernel = this->cl_helper_.KernelAt(0);
const
auto
*
input
=
param
.
InputX
();
//
const auto* input = param.InputX();
auto
*
output
=
param
.
Out
();
//
auto* output = param.Out();
auto
default_work_size
=
this
->
cl_helper_
.
DefaultWorkSize
(
*
output
);
//
auto default_work_size = this->cl_helper_.DefaultWorkSize(*output);
auto
inputImage
=
input
->
GetCLImage
();
//
auto inputImage = input->GetCLImage();
auto
outputImage
=
output
->
GetCLImage
();
//
auto outputImage = output->GetCLImage();
clSetKernelArg
(
kernel
,
0
,
sizeof
(
cl_mem
),
&
inputImage
);
//
clSetKernelArg(kernel, 0, sizeof(cl_mem), &inputImage);
clSetKernelArg
(
kernel
,
1
,
sizeof
(
cl_mem
),
&
outputImage
);
//
clSetKernelArg(kernel, 1, sizeof(cl_mem), &outputImage);
const
size_t
work_size
[
2
]
=
{
input
->
ImageWidth
(),
input
->
ImageHeight
()};
//
const size_t work_size[2] = {input->ImageWidth(), input->ImageHeight()};
clEnqueueNDRangeKernel
(
this
->
cl_helper_
.
CLCommandQueue
(),
kernel
,
3
,
NULL
,
//
clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 3, NULL,
work_size
,
NULL
,
0
,
NULL
,
NULL
);
//
work_size, NULL, 0, NULL, NULL);
}
}
template
class
ReluKernel
<
GPU_CL
,
float
>;
template
class
ReluKernel
<
GPU_CL
,
float
>;
...
...
src/operators/kernel/cl/softmax_kernel.cpp
浏览文件 @
e81515d3
...
@@ -36,11 +36,14 @@ void SoftmaxKernel<GPU_CL, float>::Compute(const SoftmaxParam<GPU_CL> ¶m) {
...
@@ -36,11 +36,14 @@ void SoftmaxKernel<GPU_CL, float>::Compute(const SoftmaxParam<GPU_CL> ¶m) {
clSetKernelArg
(
kernel
,
0
,
sizeof
(
cl_mem
),
&
inputImage
);
clSetKernelArg
(
kernel
,
0
,
sizeof
(
cl_mem
),
&
inputImage
);
clSetKernelArg
(
kernel
,
1
,
sizeof
(
cl_mem
),
&
outputImage
);
clSetKernelArg
(
kernel
,
1
,
sizeof
(
cl_mem
),
&
outputImage
);
const
auto
&
inputDim
=
input
->
dims
();
const
auto
&
inputDim
=
input
->
dims
();
int
dims
[
4
]
=
{
inputDim
[
0
],
inputDim
[
1
],
inputDim
[
2
],
inputDim
[
3
]};
int
dims
[
4
]
=
{
1
,
1
,
1
,
1
};
clSetKernelArg
(
kernel
,
2
,
sizeof
(
int
),
dims
);
for
(
int
i
=
0
;
i
<
inputDim
.
size
();
i
++
)
{
clSetKernelArg
(
kernel
,
3
,
sizeof
(
int
),
dims
+
1
);
dims
[
4
-
inputDim
.
size
()
+
i
]
=
inputDim
[
i
];
clSetKernelArg
(
kernel
,
4
,
sizeof
(
int
),
dims
+
2
);
}
clSetKernelArg
(
kernel
,
5
,
sizeof
(
int
),
dims
+
3
);
clSetKernelArg
(
kernel
,
2
,
sizeof
(
int
),
&
dims
);
clSetKernelArg
(
kernel
,
3
,
sizeof
(
int
),
&
dims
[
1
]);
clSetKernelArg
(
kernel
,
4
,
sizeof
(
int
),
&
dims
[
2
]);
clSetKernelArg
(
kernel
,
5
,
sizeof
(
int
),
&
dims
[
3
]);
clEnqueueNDRangeKernel
(
this
->
cl_helper_
.
CLCommandQueue
(),
kernel
,
3
,
NULL
,
clEnqueueNDRangeKernel
(
this
->
cl_helper_
.
CLCommandQueue
(),
kernel
,
3
,
NULL
,
default_work_size
.
data
(),
NULL
,
0
,
NULL
,
NULL
);
default_work_size
.
data
(),
NULL
,
0
,
NULL
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录