Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
dc7c1455
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看板
提交
dc7c1455
编写于
10月 19, 2018
作者:
Z
zhaojiaying01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update fetch kernel
上级
98f3e10f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
27 addition
and
9 deletion
+27
-9
src/framework/executor.cpp
src/framework/executor.cpp
+13
-3
src/operators/kernel/cl/fetch_kernel.cpp
src/operators/kernel/cl/fetch_kernel.cpp
+13
-5
src/operators/op_param.h
src/operators/op_param.h
+1
-1
未找到文件。
src/framework/executor.cpp
浏览文件 @
dc7c1455
...
...
@@ -37,7 +37,7 @@ limitations under the License. */
#include "framework/cl/cl_image.h"
#endif
int
debug_to
=
3
4
;
int
debug_to
=
3
3
;
namespace
paddle_mobile
{
namespace
framework
{
...
...
@@ -922,7 +922,12 @@ void Executor<GPU_CL, Precision::FP32>::InitMemory() {
if
(
var_desc
->
Persistable
())
{
CLImage
*
cl_image
=
nullptr
;
if
(
var_desc
->
Name
()
==
"feed"
||
var_desc
->
Name
()
==
"fetch"
)
{
var
->
template
GetMutable
<
framework
::
LoDTensor
>();
auto
tensor
=
var
->
template
GetMutable
<
framework
::
LoDTensor
>();
if
(
var_desc
->
Name
()
==
"fetch"
)
{
const
framework
::
TensorDesc
&
desc
=
var_desc
->
Tensor_desc
();
framework
::
DDim
ddim
=
framework
::
make_ddim
(
desc
.
Dims
());
tensor
->
mutable_data
<
float
>
(
ddim
);
}
continue
;
}
else
{
cl_image
=
var
->
template
GetMutable
<
framework
::
CLImage
>();
...
...
@@ -986,7 +991,12 @@ void Executor<GPU_CL, Precision::FP32>::InitCombineMemory() {
if
(
var_desc
->
Persistable
())
{
CLImage
*
cl_image
=
nullptr
;
if
(
var_desc
->
Name
()
==
"feed"
||
var_desc
->
Name
()
==
"fetch"
)
{
var
->
template
GetMutable
<
framework
::
LoDTensor
>();
auto
tensor
=
var
->
template
GetMutable
<
framework
::
LoDTensor
>();
if
(
var_desc
->
Name
()
==
"fetch"
)
{
const
framework
::
TensorDesc
&
desc
=
var_desc
->
Tensor_desc
();
framework
::
DDim
ddim
=
framework
::
make_ddim
(
desc
.
Dims
());
tensor
->
mutable_data
<
float
>
(
ddim
);
}
continue
;
}
else
{
cl_image
=
var
->
template
GetMutable
<
framework
::
CLImage
>();
...
...
src/operators/kernel/cl/fetch_kernel.cpp
浏览文件 @
dc7c1455
...
...
@@ -32,11 +32,19 @@ void FetchKernel<GPU_CL, float>::Compute(const FetchParam<GPU_CL> ¶m) {
auto
input
=
param
.
InputX
()
->
GetCLImage
();
auto
*
out
=
param
.
Out
();
const
auto
&
dims
=
param
.
InputX
()
->
dims
();
const
int
N
=
dims
[
0
];
const
int
C
=
dims
[
1
];
const
int
in_height
=
dims
[
2
];
const
int
in_width
=
dims
[
3
];
const
auto
&
dim
=
param
.
InputX
()
->
dims
();
size_t
new_dims
[]
=
{
1
,
1
,
1
,
1
};
for
(
int
j
=
0
;
j
<
dim
.
size
();
++
j
)
{
new_dims
[
4
-
dim
.
size
()
+
j
]
=
dim
[
j
];
}
size_t
N
,
C
,
in_height
,
in_width
;
N
=
new_dims
[
0
];
C
=
new_dims
[
1
];
in_height
=
new_dims
[
2
];
in_width
=
new_dims
[
3
];
int
size_ch
=
in_height
*
in_width
;
int
size_block
=
size_ch
*
4
;
...
...
src/operators/op_param.h
浏览文件 @
dc7c1455
...
...
@@ -953,7 +953,7 @@ class FetchParam : public OpParam {
Tensor
*
Out
()
const
{
return
out_
;
}
static
Tensor
*
OutFrom
(
const
VariableNameMap
&
outputs
,
const
Scope
&
scope
)
{
return
GetVarValue
<
Tensor
>
(
"Out"
,
outputs
,
scope
);
return
GetVarValue
<
LoD
Tensor
>
(
"Out"
,
outputs
,
scope
);
}
private:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录