Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
beff011a
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看板
提交
beff011a
编写于
12月 26, 2018
作者:
xiebaiyuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
run android gpu for super -- update test and fix bug with wh changed
上级
6f4b68b5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
84 addition
and
16 deletion
+84
-16
CMakeLists.txt
CMakeLists.txt
+3
-3
src/framework/executor.cpp
src/framework/executor.cpp
+6
-6
test/net/test_super.cpp
test/net/test_super.cpp
+75
-7
未找到文件。
CMakeLists.txt
浏览文件 @
beff011a
cmake_minimum_required
(
VERSION 3.0.0
)
cmake_minimum_required
(
VERSION 3.0.0
)
option
(
USE_OPENMP
"openmp support"
O
N
)
option
(
USE_OPENMP
"openmp support"
O
FF
)
option
(
DEBUGING
"enable debug mode"
ON
)
option
(
DEBUGING
"enable debug mode"
ON
)
option
(
USE_EXCEPTION
"use std exception"
ON
)
option
(
USE_EXCEPTION
"use std exception"
ON
)
option
(
SYMBOL_HIDDEN
"symbol hidden"
OFF
)
# on when use jni or ios io
option
(
SYMBOL_HIDDEN
"symbol hidden"
OFF
)
# on when use jni or ios io
option
(
LOG_PROFILE
"log profile"
O
FF
)
option
(
LOG_PROFILE
"log profile"
O
N
)
# select the platform to build
# select the platform to build
option
(
CPU
"armv7 with neon"
ON
)
option
(
CPU
"armv7 with neon"
ON
)
option
(
GPU_MALI
"mali gpu"
OFF
)
option
(
GPU_MALI
"mali gpu"
OFF
)
option
(
GPU_CL
"opencl gpu"
O
FF
)
option
(
GPU_CL
"opencl gpu"
O
N
)
option
(
FPGA
"fpga"
OFF
)
option
(
FPGA
"fpga"
OFF
)
if
(
FPGA
)
if
(
FPGA
)
...
...
src/framework/executor.cpp
浏览文件 @
beff011a
...
@@ -551,13 +551,12 @@ void Executor<GPU_CL, float>::SetInput(const Tensor &input,
...
@@ -551,13 +551,12 @@ void Executor<GPU_CL, float>::SetInput(const Tensor &input,
DLOG
<<
"target_tensor->IsInitialized() "
<<
target_tensor
->
IsInitialized
();
DLOG
<<
"target_tensor->IsInitialized() "
<<
target_tensor
->
IsInitialized
();
DLOG
<<
"target_tensor->dims() "
<<
target_tensor
->
dims
();
DLOG
<<
"target_tensor->dims() "
<<
target_tensor
->
dims
();
DLOG
<<
"input.dims() "
<<
input
.
dims
();
DLOG
<<
"input.dims() "
<<
input
.
dims
();
DLOG
<<
"input_dim_last_ "
<<
input_dim_last_
;
if
(
config_
.
load_when_predict
)
{
if
(
config_
.
load_when_predict
)
{
if
(
input_dim_last_
!=
input
.
dims
())
{
if
(
input_dim_last_
!=
input
.
dims
())
{
if
(
!
target_tensor
->
IsInitialized
())
{
DLOG
<<
"SetInput ---- > resize1"
;
DLOG
<<
"SetInput ---- > resize1"
;
target_tensor
->
Resize
(
input
.
dims
());
target_tensor
->
Resize
(
input
.
dims
());
target_tensor
->
mutable_data
<
float
>
();
target_tensor
->
mutable_data
<
float
>
();
}
InitNoPersistableMemory
(
*
target_tensor
);
InitNoPersistableMemory
(
*
target_tensor
);
}
}
}
else
{
}
else
{
...
@@ -566,7 +565,8 @@ void Executor<GPU_CL, float>::SetInput(const Tensor &input,
...
@@ -566,7 +565,8 @@ void Executor<GPU_CL, float>::SetInput(const Tensor &input,
DLOG
<<
"SetInput ---- > ShareDataWith"
;
DLOG
<<
"SetInput ---- > ShareDataWith"
;
}
}
target_tensor
->
ShareDataWith
(
input
);
target_tensor
->
ShareDataWith
(
input
);
input_dim_last_
=
input
.
dims
();
auto
&
dim
=
input
.
dims
();
input_dim_last_
=
static_cast
<
DDim
>
(
dim
);
}
}
template
<
typename
Device
,
typename
T
>
template
<
typename
Device
,
typename
T
>
...
...
test/net/test_super.cpp
浏览文件 @
beff011a
...
@@ -37,7 +37,7 @@ int main() {
...
@@ -37,7 +37,7 @@ int main() {
auto
time2
=
paddle_mobile
::
time
();
auto
time2
=
paddle_mobile
::
time
();
std
::
cout
<<
"load cost :"
<<
paddle_mobile
::
time_diff
(
time1
,
time2
)
<<
"ms"
std
::
cout
<<
"load cost :"
<<
paddle_mobile
::
time_diff
(
time1
,
time2
)
<<
"ms"
<<
std
::
endl
;
<<
std
::
endl
;
// 300*300
std
::
vector
<
float
>
input
;
std
::
vector
<
float
>
input
;
std
::
vector
<
int64_t
>
dims
{
1
,
1
,
300
,
300
};
std
::
vector
<
int64_t
>
dims
{
1
,
1
,
300
,
300
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input
,
dims
);
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input
,
dims
);
...
@@ -51,22 +51,90 @@ int main() {
...
@@ -51,22 +51,90 @@ int main() {
auto
time5
=
paddle_mobile
::
time
();
auto
time5
=
paddle_mobile
::
time
();
vec_result
=
paddle_mobile
.
Predict
(
input
,
dims
);
vec_result
=
paddle_mobile
.
Predict
(
input
,
dims
);
auto
time6
=
paddle_mobile
::
time
();
auto
time6
=
paddle_mobile
::
time
();
std
::
cout
<<
"predict cost :第"
<<
i
<<
": "
std
::
cout
<<
"
300
predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time5
,
time6
)
<<
"ms"
<<
std
::
endl
;
<<
paddle_mobile
::
time_diff
(
time5
,
time6
)
<<
"ms"
<<
std
::
endl
;
}
}
auto
time4
=
paddle_mobile
::
time
();
auto
time4
=
paddle_mobile
::
time
();
std
::
cout
<<
"predict cost :"
std
::
cout
<<
"
300
predict cost :"
<<
paddle_mobile
::
time_diff
(
time3
,
time4
)
/
max
<<
"ms"
<<
paddle_mobile
::
time_diff
(
time3
,
time4
)
/
max
<<
"ms"
<<
std
::
endl
;
<<
std
::
endl
;
auto
biggest
=
auto
biggest
=
std
::
max_element
(
std
::
begin
(
vec_result
),
std
::
end
(
vec_result
));
std
::
max_element
(
std
::
begin
(
vec_result
),
std
::
end
(
vec_result
));
std
::
cout
<<
" Max element is "
<<
*
biggest
<<
" at position "
std
::
cout
<<
"
300
Max element is "
<<
*
biggest
<<
" at position "
<<
std
::
distance
(
std
::
begin
(
vec_result
),
biggest
)
<<
std
::
endl
;
<<
std
::
distance
(
std
::
begin
(
vec_result
),
biggest
)
<<
std
::
endl
;
// 500*500
std
::
vector
<
float
>
vec_result2
;
std
::
vector
<
float
>
input2
;
std
::
vector
<
int64_t
>
dims2
{
1
,
1
,
500
,
500
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input2
,
dims2
);
time3
=
paddle_mobile
::
time
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
auto
time5
=
paddle_mobile
::
time
();
vec_result2
=
paddle_mobile
.
Predict
(
input2
,
dims2
);
auto
time6
=
paddle_mobile
::
time
();
std
::
cout
<<
"500 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time5
,
time6
)
<<
"ms"
<<
std
::
endl
;
}
time4
=
paddle_mobile
::
time
();
std
::
cout
<<
"500 predict cost :"
<<
paddle_mobile
::
time_diff
(
time3
,
time4
)
/
max
<<
"ms"
<<
std
::
endl
;
biggest
=
std
::
max_element
(
std
::
begin
(
vec_result2
),
std
::
end
(
vec_result2
));
std
::
cout
<<
"500 Max element is "
<<
*
biggest
<<
" at position "
<<
std
::
distance
(
std
::
begin
(
vec_result2
),
biggest
)
<<
std
::
endl
;
// 1000*1000
std
::
vector
<
float
>
vec_result3
;
std
::
vector
<
float
>
input3
;
std
::
vector
<
int64_t
>
dims3
{
1
,
1
,
1000
,
1000
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input3
,
dims3
);
time3
=
paddle_mobile
::
time
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
auto
time5
=
paddle_mobile
::
time
();
vec_result3
=
paddle_mobile
.
Predict
(
input3
,
dims3
);
auto
time6
=
paddle_mobile
::
time
();
std
::
cout
<<
"1000*1000 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time5
,
time6
)
<<
"ms"
<<
std
::
endl
;
}
time4
=
paddle_mobile
::
time
();
std
::
cout
<<
"1000*1000 predict cost :"
<<
paddle_mobile
::
time_diff
(
time3
,
time4
)
/
max
<<
"ms"
<<
std
::
endl
;
biggest
=
std
::
max_element
(
std
::
begin
(
vec_result3
),
std
::
end
(
vec_result3
));
std
::
cout
<<
"1000*1000 Max element is "
<<
*
biggest
<<
" at position "
<<
std
::
distance
(
std
::
begin
(
vec_result3
),
biggest
)
<<
std
::
endl
;
// 224*224
std
::
vector
<
float
>
vec_result4
;
std
::
vector
<
float
>
input4
;
std
::
vector
<
int64_t
>
dims4
{
1
,
1
,
224
,
224
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input4
,
dims4
);
time3
=
paddle_mobile
::
time
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
auto
time5
=
paddle_mobile
::
time
();
vec_result4
=
paddle_mobile
.
Predict
(
input4
,
dims4
);
auto
time6
=
paddle_mobile
::
time
();
std
::
cout
<<
"224*224 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time5
,
time6
)
<<
"ms"
<<
std
::
endl
;
}
time4
=
paddle_mobile
::
time
();
std
::
cout
<<
"224*224 predict cost :"
<<
paddle_mobile
::
time_diff
(
time3
,
time4
)
/
max
<<
"ms"
<<
std
::
endl
;
biggest
=
std
::
max_element
(
std
::
begin
(
vec_result4
),
std
::
end
(
vec_result4
));
std
::
cout
<<
"224*224 Max element is "
<<
*
biggest
<<
" at position "
<<
std
::
distance
(
std
::
begin
(
vec_result4
),
biggest
)
<<
std
::
endl
;
}
}
std
::
cout
<<
"如果结果Nan请查看: test/images/g_test_image_1x3x224x224_banana "
"是否存在?"
<<
std
::
endl
;
return
0
;
return
0
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录