Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f417c151
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看板
提交
f417c151
编写于
10月 17, 2018
作者:
Y
yangfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
imp CLImage printer function
上级
b03ad9ea
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
7 deletion
+16
-7
src/framework/cl/cl_image.cpp
src/framework/cl/cl_image.cpp
+5
-4
src/framework/cl/cl_image.h
src/framework/cl/cl_image.h
+11
-3
未找到文件。
src/framework/cl/cl_image.cpp
浏览文件 @
f417c151
...
@@ -125,7 +125,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
...
@@ -125,7 +125,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
float
*
data
=
new
float
[
cl_image
.
numel
()];
float
*
data
=
new
float
[
cl_image
.
numel
()];
DDim
ddim
=
cl_image
.
dims
();
DDim
ddim
=
cl_image
.
dims
();
size_t
N
,
C
,
H
,
W
,
width
,
height
;
size_t
N
,
C
,
H
,
W
,
width
,
height
;
if
(
cl_image
.
GetImageType
()
==
Normal
)
{
if
(
cl_image
.
GetImageType
()
==
0
||
ddim
.
size
()
==
4
)
{
if
(
ddim
.
size
()
==
4
)
{
if
(
ddim
.
size
()
==
4
)
{
N
=
ddim
[
0
];
N
=
ddim
[
0
];
if
(
N
<
0
)
{
if
(
N
<
0
)
{
...
@@ -152,7 +152,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
...
@@ -152,7 +152,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
W
=
ddim
[
0
];
W
=
ddim
[
0
];
}
}
float
*
p
=
data
;
float
*
p
=
data
;
half
imageData
[
width
*
height
*
4
];
half
*
imageData
=
new
half
[
height
*
width
*
4
];
cl_int
err
;
cl_int
err
;
cl_mem
image
=
cl_image
.
GetCLImage
();
cl_mem
image
=
cl_image
.
GetCLImage
();
size_t
origin
[
3
]
=
{
0
,
0
,
0
};
size_t
origin
[
3
]
=
{
0
,
0
,
0
};
...
@@ -175,7 +175,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
...
@@ -175,7 +175,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
}
}
i0
+=
width
*
H
;
i0
+=
width
*
H
;
}
}
delete
(
imageData
);
CL_CHECK_ERRORS
(
err
);
CL_CHECK_ERRORS
(
err
);
}
else
{
}
else
{
if
(
ddim
.
size
()
==
2
)
{
if
(
ddim
.
size
()
==
2
)
{
...
@@ -191,7 +191,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
...
@@ -191,7 +191,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
W
=
ddim
[
0
];
W
=
ddim
[
0
];
}
}
float
*
p
=
data
;
float
*
p
=
data
;
half
imageData
[
width
*
height
*
4
];
half
*
imageData
=
new
half
[
width
*
height
*
4
];
cl_int
err
;
cl_int
err
;
cl_mem
image
=
cl_image
.
GetCLImage
();
cl_mem
image
=
cl_image
.
GetCLImage
();
size_t
origin
[
3
]
=
{
0
,
0
,
0
};
size_t
origin
[
3
]
=
{
0
,
0
,
0
};
...
@@ -210,6 +210,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
...
@@ -210,6 +210,7 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
for
(
int
i
=
0
;
i
<
cl_image
.
numel
();
i
+=
stride
)
{
for
(
int
i
=
0
;
i
<
cl_image
.
numel
();
i
+=
stride
)
{
printer
<<
data
[
i
]
<<
" "
;
printer
<<
data
[
i
]
<<
" "
;
}
}
delete
(
data
);
return
printer
;
return
printer
;
}
}
#endif
#endif
...
...
src/framework/cl/cl_image.h
浏览文件 @
f417c151
...
@@ -26,7 +26,7 @@ limitations under the License. */
...
@@ -26,7 +26,7 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
framework
{
namespace
framework
{
enum
ImageType
{
Normal
,
Folder
};
enum
ImageType
{
Normal
=
0
,
Folder
=
1
};
class
CLImage
{
class
CLImage
{
public:
public:
...
@@ -88,7 +88,7 @@ class CLImage {
...
@@ -88,7 +88,7 @@ class CLImage {
cl_mem
GetCLImage
()
const
{
return
cl_image_
;
}
cl_mem
GetCLImage
()
const
{
return
cl_image_
;
}
const
DDim
&
ImageDims
()
{
return
image_dims_
;
}
const
DDim
&
ImageDims
()
const
{
return
image_dims_
;
}
inline
size_t
ImageWidth
()
const
{
return
image_width_
;
}
inline
size_t
ImageWidth
()
const
{
return
image_width_
;
}
...
@@ -139,7 +139,7 @@ class CLImage {
...
@@ -139,7 +139,7 @@ class CLImage {
* */
* */
const
DDim
&
dims
()
const
{
return
tensor_dims_
;
}
const
DDim
&
dims
()
const
{
return
tensor_dims_
;
}
const
ImageType
GetImageType
()
const
{
type
;
}
const
ImageType
GetImageType
()
const
{
return
type
;
}
private:
private:
ImageType
type
;
ImageType
type
;
...
@@ -157,6 +157,14 @@ class CLImage {
...
@@ -157,6 +157,14 @@ class CLImage {
}
}
int
width
=
(
tdim
[
1
]
+
3
)
/
4
;
int
width
=
(
tdim
[
1
]
+
3
)
/
4
;
int
height
=
tdim
[
0
];
int
height
=
tdim
[
0
];
width_of_one_block_
=
tdim
[
1
];
height_of_one_block_
=
tdim
[
0
];
image_width_
=
width
;
image_height_
=
height
;
image_dims_
=
make_ddim
({
image_width_
,
image_height_
});
c_block_
=
tdim
[
1
]
/
width
;
std
::
unique_ptr
<
half_t
[]
>
imageData
{};
std
::
unique_ptr
<
half_t
[]
>
imageData
{};
if
(
tensor_data
)
{
if
(
tensor_data
)
{
imageData
.
reset
(
new
half_t
[
width
*
height
*
4
]);
imageData
.
reset
(
new
half_t
[
width
*
height
*
4
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录