Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
7faca1ad
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看板
提交
7faca1ad
编写于
1月 18, 2019
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format files
上级
65df2628
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
85 addition
and
75 deletion
+85
-75
src/framework/executor.cpp
src/framework/executor.cpp
+1
-2
src/io/paddle_mobile.cpp
src/io/paddle_mobile.cpp
+2
-1
test/net/test_super.cpp
test/net/test_super.cpp
+82
-72
未找到文件。
src/framework/executor.cpp
浏览文件 @
7faca1ad
...
...
@@ -237,8 +237,7 @@ void Executor<Device, T>::InitCombineMemory() {
}
template
<
typename
Device
,
typename
T
>
void
Executor
<
Device
,
T
>::
InitNoPersistableMemory
(
const
Tensor
&
input_tensor
)
{
void
Executor
<
Device
,
T
>::
InitNoPersistableMemory
(
const
Tensor
&
input_tensor
)
{
for
(
const
auto
&
block
:
program_desc_
->
Blocks
())
{
for
(
const
auto
&
var_desc
:
block
->
Vars
())
{
auto
var
=
program_
.
scope
->
Var
(
var_desc
->
Name
());
...
...
src/io/paddle_mobile.cpp
浏览文件 @
7faca1ad
...
...
@@ -105,7 +105,8 @@ bool PaddleMobile<Device, T>::LoadCombinedMemory(
executor_
=
std
::
make_shared
<
framework
::
Executor
<
Device
,
T
>>
(
loader_
->
LoadCombinedMemory
(
model_len
,
model_buf
,
combined_params_len
,
combined_params_buf
,
optimize
,
quantification
),
config_
,
batch_size
,
optimize
,
lod_mode
);
quantification
),
config_
,
batch_size
,
optimize
,
lod_mode
);
}
else
{
LOG
(
kLOG_INFO
)
<<
"executor inited"
;
}
...
...
test/net/test_super.cpp
浏览文件 @
7faca1ad
...
...
@@ -38,79 +38,87 @@ int main() {
std
::
cout
<<
"load cost :"
<<
paddle_mobile
::
time_diff
(
time1
,
time2
)
<<
"ms"
<<
std
::
endl
;
// 300*300
// std::vector<float> input;
// std::vector<int64_t> dims{1, 1, 300, 300};
// GetInput<float>(g_test_image_1x3x224x224, &input, dims);
//
// std::vector<float> vec_result;
// std::vector<float> input;
// std::vector<int64_t> dims{1, 1, 300, 300};
// GetInput<float>(g_test_image_1x3x224x224, &input, dims);
//
// std::vector<float> vec_result;
auto
time3
=
paddle_mobile
::
time
();
int
max
=
1
;
// for (int i = 0; i < max; ++i) {
// auto time5 = paddle_mobile::time();
// vec_result = paddle_mobile.Predict(input, dims);
// auto time6 = paddle_mobile::time();
// std::cout << "300 predict cost :第" << i << ": "
// << paddle_mobile::time_diff(time5, time6) << "ms" << std::endl;
// }
// auto time4 = paddle_mobile::time();
//
// std::cout << "300 predict cost :"
// << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::endl;
// auto biggest =
// std::max_element(std::begin(vec_result), std::end(vec_result));
// std::cout << "300 Max element is " << *biggest << " at position "
// << 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;
// for (int i = 0; i < max; ++i) {
// auto time5 = paddle_mobile::time();
// vec_result = paddle_mobile.Predict(input, dims);
// auto time6 = paddle_mobile::time();
// std::cout << "300 predict cost :第" << i << ": "
// << paddle_mobile::time_diff(time5, time6) << "ms" <<
// std::endl;
// }
// auto time4 = paddle_mobile::time();
//
// std::cout << "300 predict cost :"
// << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::endl;
// auto biggest =
// std::max_element(std::begin(vec_result), std::end(vec_result));
// std::cout << "300 Max element is " << *biggest << " at position "
// << 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
;
...
...
@@ -131,9 +139,11 @@ int main() {
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;
// 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;
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录