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

format files

上级 65df2628
...@@ -237,8 +237,7 @@ void Executor<Device, T>::InitCombineMemory() { ...@@ -237,8 +237,7 @@ void Executor<Device, T>::InitCombineMemory() {
} }
template <typename Device, typename T> template <typename Device, typename T>
void Executor<Device, T>::InitNoPersistableMemory( void Executor<Device, T>::InitNoPersistableMemory(const Tensor &input_tensor) {
const Tensor &input_tensor) {
for (const auto &block : program_desc_->Blocks()) { for (const auto &block : program_desc_->Blocks()) {
for (const auto &var_desc : block->Vars()) { for (const auto &var_desc : block->Vars()) {
auto var = program_.scope->Var(var_desc->Name()); auto var = program_.scope->Var(var_desc->Name());
......
...@@ -105,7 +105,8 @@ bool PaddleMobile<Device, T>::LoadCombinedMemory( ...@@ -105,7 +105,8 @@ bool PaddleMobile<Device, T>::LoadCombinedMemory(
executor_ = std::make_shared<framework::Executor<Device, T>>( executor_ = std::make_shared<framework::Executor<Device, T>>(
loader_->LoadCombinedMemory(model_len, model_buf, combined_params_len, loader_->LoadCombinedMemory(model_len, model_buf, combined_params_len,
combined_params_buf, optimize, combined_params_buf, optimize,
quantification), config_, batch_size, optimize, lod_mode); quantification),
config_, batch_size, optimize, lod_mode);
} else { } else {
LOG(kLOG_INFO) << "executor inited"; LOG(kLOG_INFO) << "executor inited";
} }
......
...@@ -38,79 +38,87 @@ int main() { ...@@ -38,79 +38,87 @@ int main() {
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 // 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);
// //
// std::vector<float> vec_result; // std::vector<float> vec_result;
auto time3 = paddle_mobile::time(); auto time3 = paddle_mobile::time();
int max = 1; int max = 1;
// for (int i = 0; i < max; ++i) { // for (int i = 0; i < max; ++i) {
// 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 << "300 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 << "300 predict cost :" //
// << paddle_mobile::time_diff(time3, time4) / max << "ms" // std::cout << "300 predict cost :"
// << std::endl; // << paddle_mobile::time_diff(time3, time4) / max << "ms"
// auto biggest = // << std::endl;
// std::max_element(std::begin(vec_result), std::end(vec_result)); // auto biggest =
// std::cout << "300 Max element is " << *biggest << " at position " // std::max_element(std::begin(vec_result), std::end(vec_result));
// << std::distance(std::begin(vec_result), biggest) << std::endl; // std::cout << "300 Max element is " << *biggest << " at position "
// // << std::distance(std::begin(vec_result), biggest) <<
// // 500*500 // std::endl;
// std::vector<float> vec_result2; //
// // // 500*500
// std::vector<float> input2; // std::vector<float> vec_result2;
// std::vector<int64_t> dims2{1, 1, 500, 500}; //
// GetInput<float>(g_test_image_1x3x224x224, &input2, dims2); // std::vector<float> input2;
// // std::vector<int64_t> dims2{1, 1, 500, 500};
// time3 = paddle_mobile::time(); // GetInput<float>(g_test_image_1x3x224x224, &input2, dims2);
// for (int i = 0; i < max; ++i) { //
// auto time5 = paddle_mobile::time(); // time3 = paddle_mobile::time();
// vec_result2 = paddle_mobile.Predict(input2, dims2); // for (int i = 0; i < max; ++i) {
// auto time6 = paddle_mobile::time(); // auto time5 = paddle_mobile::time();
// std::cout << "500 predict cost :第" << i << ": " // vec_result2 = paddle_mobile.Predict(input2, dims2);
// << paddle_mobile::time_diff(time5, time6) << "ms" << std::endl; // auto time6 = paddle_mobile::time();
// } // std::cout << "500 predict cost :第" << i << ": "
// // << paddle_mobile::time_diff(time5, time6) << "ms" <<
// time4 = paddle_mobile::time(); // std::endl;
// std::cout << "500 predict cost :" // }
// << paddle_mobile::time_diff(time3, time4) / max << "ms" //
// << std::endl; // time4 = paddle_mobile::time();
// biggest = std::max_element(std::begin(vec_result2), std::end(vec_result2)); // std::cout << "500 predict cost :"
// std::cout << "500 Max element is " << *biggest << " at position " // << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::distance(std::begin(vec_result2), biggest) << std::endl; // << std::endl;
// // biggest = std::max_element(std::begin(vec_result2),
// // 1000*1000 // std::end(vec_result2)); std::cout << "500 Max element is " << *biggest
// // << " at position "
// std::vector<float> vec_result3; // << std::distance(std::begin(vec_result2), biggest) <<
// std::vector<float> input3; // std::endl;
// std::vector<int64_t> dims3{1, 1, 1000, 1000}; //
// GetInput<float>(g_test_image_1x3x224x224, &input3, dims3); // // 1000*1000
// //
// time3 = paddle_mobile::time(); // std::vector<float> vec_result3;
// // std::vector<float> input3;
// for (int i = 0; i < max; ++i) { // std::vector<int64_t> dims3{1, 1, 1000, 1000};
// auto time5 = paddle_mobile::time(); // GetInput<float>(g_test_image_1x3x224x224, &input3, dims3);
// vec_result3 = paddle_mobile.Predict(input3, dims3); //
// auto time6 = paddle_mobile::time(); // time3 = paddle_mobile::time();
// std::cout << "1000*1000 predict cost :第" << i << ": " //
// << paddle_mobile::time_diff(time5, time6) << "ms" << std::endl; // for (int i = 0; i < max; ++i) {
// } // auto time5 = paddle_mobile::time();
// time4 = paddle_mobile::time(); // vec_result3 = paddle_mobile.Predict(input3, dims3);
// std::cout << "1000*1000 predict cost :" // auto time6 = paddle_mobile::time();
// << paddle_mobile::time_diff(time3, time4) / max << "ms" // std::cout << "1000*1000 predict cost :第" << i << ": "
// << std::endl; // << paddle_mobile::time_diff(time5, time6) << "ms" <<
// biggest = std::max_element(std::begin(vec_result3), std::end(vec_result3)); // std::endl;
// std::cout << "1000*1000 Max element is " << *biggest << " at position " // }
// << std::distance(std::begin(vec_result3), biggest) << 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 // 224*224
std::vector<float> vec_result4; std::vector<float> vec_result4;
...@@ -131,9 +139,11 @@ int main() { ...@@ -131,9 +139,11 @@ int main() {
std::cout << "224*224 predict cost :" std::cout << "224*224 predict cost :"
<< paddle_mobile::time_diff(time3, time4) / max << "ms" << paddle_mobile::time_diff(time3, time4) / max << "ms"
<< std::endl; << std::endl;
// biggest = std::max_element(std::begin(vec_result4), std::end(vec_result4)); // biggest = std::max_element(std::begin(vec_result4),
// std::cout << "224*224 Max element is " << *biggest << " at position " // std::end(vec_result4)); std::cout << "224*224 Max element is " <<
// << std::distance(std::begin(vec_result4), biggest) << std::endl; // *biggest << " at position "
// << std::distance(std::begin(vec_result4), biggest) <<
// std::endl;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册