Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
ba30ff10
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看板
提交
ba30ff10
编写于
8月 03, 2019
作者:
Z
zp7
提交者:
Yanzhan Yang
8月 03, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix reshape2&transpose2 gpu infershape (#1778)
上级
cbf15fc1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
12 addition
and
2 deletion
+12
-2
src/framework/cl/cl_image.cpp
src/framework/cl/cl_image.cpp
+2
-0
src/framework/cl/cl_image_converter.cpp
src/framework/cl/cl_image_converter.cpp
+2
-0
src/framework/executor.cpp
src/framework/executor.cpp
+1
-1
src/operators/reshape2_op.cpp
src/operators/reshape2_op.cpp
+3
-0
src/operators/transpose2_op.cpp
src/operators/transpose2_op.cpp
+3
-0
tools/python/fluidtools/run.py
tools/python/fluidtools/run.py
+1
-1
未找到文件。
src/framework/cl/cl_image.cpp
浏览文件 @
ba30ff10
...
@@ -122,6 +122,8 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
...
@@ -122,6 +122,8 @@ Print &operator<<(Print &printer, const CLImage &cl_image) {
CL_CHECK_ERRORS
(
err
);
CL_CHECK_ERRORS
(
err
);
PADDLE_MOBILE_ENFORCE
(
cl_image
.
numel
()
!=
0
,
"cl_image numel should not be 0 "
);
float
*
tensor_data
=
new
float
[
cl_image
.
numel
()];
float
*
tensor_data
=
new
float
[
cl_image
.
numel
()];
auto
converter
=
cl_image
.
Converter
();
auto
converter
=
cl_image
.
Converter
();
converter
->
ImageToNCHW
(
image_data
,
tensor_data
,
cl_image
.
ImageDims
(),
converter
->
ImageToNCHW
(
image_data
,
tensor_data
,
cl_image
.
ImageDims
(),
...
...
src/framework/cl/cl_image_converter.cpp
浏览文件 @
ba30ff10
...
@@ -391,6 +391,8 @@ void CLImageConverterDWBlock::ImageToNCHW(half_t *image, float *tensor,
...
@@ -391,6 +391,8 @@ void CLImageConverterDWBlock::ImageToNCHW(half_t *image, float *tensor,
const
DDim
&
CLImageConverterNormal
::
InitImageDimInfoWith
(
const
DDim
&
CLImageConverterNormal
::
InitImageDimInfoWith
(
const
DDim
&
tensor_dim
)
{
const
DDim
&
tensor_dim
)
{
PADDLE_MOBILE_ENFORCE
(
tensor_dim
.
size
()
<=
4
&&
tensor_dim
.
size
()
>
0
,
"tensor dim is not support "
);
size_t
new_dims
[]
=
{
1
,
1
,
1
,
1
};
size_t
new_dims
[]
=
{
1
,
1
,
1
,
1
};
for
(
int
j
=
0
;
j
<
tensor_dim
.
size
();
++
j
)
{
for
(
int
j
=
0
;
j
<
tensor_dim
.
size
();
++
j
)
{
new_dims
[
4
-
tensor_dim
.
size
()
+
j
]
=
tensor_dim
[
j
];
new_dims
[
4
-
tensor_dim
.
size
()
+
j
]
=
tensor_dim
[
j
];
...
...
src/framework/executor.cpp
浏览文件 @
ba30ff10
...
@@ -1027,7 +1027,7 @@ void Executor<GPU_CL, float>::InitCombineMemory() {
...
@@ -1027,7 +1027,7 @@ void Executor<GPU_CL, float>::InitCombineMemory() {
bool
shouldResize
=
true
;
bool
shouldResize
=
true
;
if
(
ddim
.
size
()
>
4
)
{
if
(
ddim
.
size
()
>
4
)
{
for
(
int
i
=
0
;
i
<
ddim
.
size
()
-
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
ddim
.
size
()
-
4
;
++
i
)
{
if
(
ddim
[
i
]
!=
0
)
{
if
(
ddim
[
i
]
!=
0
&&
ddim
[
i
]
!=
1
)
{
shouldResize
=
false
;
shouldResize
=
false
;
break
;
break
;
}
}
...
...
src/operators/reshape2_op.cpp
浏览文件 @
ba30ff10
...
@@ -75,6 +75,9 @@ void Reshape2Op<Dtype, T>::InferShape() const {
...
@@ -75,6 +75,9 @@ void Reshape2Op<Dtype, T>::InferShape() const {
xshape_dims
[
i
+
1
]
=
input_x_dims
[
i
];
xshape_dims
[
i
+
1
]
=
input_x_dims
[
i
];
}
}
this
->
param_
.
OutputXShape
()
->
Resize
(
framework
::
make_ddim
(
xshape_dims
));
this
->
param_
.
OutputXShape
()
->
Resize
(
framework
::
make_ddim
(
xshape_dims
));
#ifdef PADDLE_MOBILE_CL
this
->
param_
.
OutputXShape
()
->
Resize
(
input_x_dims
);
#endif
}
}
}
// namespace operators
}
// namespace operators
...
...
src/operators/transpose2_op.cpp
浏览文件 @
ba30ff10
...
@@ -100,6 +100,9 @@ void Transpose2Op<Dtype, T>::InferShape() const {
...
@@ -100,6 +100,9 @@ void Transpose2Op<Dtype, T>::InferShape() const {
xshape_dims
[
i
+
1
]
=
input_x_dims
[
i
];
xshape_dims
[
i
+
1
]
=
input_x_dims
[
i
];
}
}
this
->
param_
.
OutputXShape
()
->
Resize
(
framework
::
make_ddim
(
xshape_dims
));
this
->
param_
.
OutputXShape
()
->
Resize
(
framework
::
make_ddim
(
xshape_dims
));
#ifdef PADDLE_MOBILE_CL
this
->
param_
.
OutputXShape
()
->
Resize
(
input_x_dims
);
#endif
}
}
}
// namespace operators
}
// namespace operators
...
...
tools/python/fluidtools/run.py
浏览文件 @
ba30ff10
...
@@ -155,7 +155,7 @@ def load_feed_kv():
...
@@ -155,7 +155,7 @@ def load_feed_kv():
expected_len
=
1
expected_len
=
1
for
dim
in
feed_shape
:
for
dim
in
feed_shape
:
expected_len
*=
dim
expected_len
*=
dim
if
len
(
data
)
!=
expected_len
:
if
len
(
np
.
atleast_1d
(
data
)
)
!=
expected_len
:
return
None
return
None
data
=
data
.
reshape
(
feed_shape
).
astype
(
"float32"
)
data
=
data
.
reshape
(
feed_shape
).
astype
(
"float32"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录