提交 7faca1ad 编写于 作者: L liuruilong

format files

上级 65df2628
......@@ -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());
......
......@@ -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";
}
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册