Change int8v2 CAPI unit test name and add log in the prediction stage (#18200)

* fix issue 18111;test=develop

* fix timer;test=develop

* refine code;test=develop
revert-18229-add_multi_gpu_install_check
翟飞跃 6 years ago committed by Tao Luo
parent 802ea50956
commit de42fe8fd5

@ -138,7 +138,7 @@ void SetInput(std::vector<std::vector<PaddleTensor>> *inputs,
}
}
TEST(Analyzer_int8_resnet50, quantization) {
TEST(Analyzer_int8_image_classification, quantization) {
AnalysisConfig cfg;
SetConfig(&cfg);

@ -336,14 +336,20 @@ void PredictionRun(PaddlePredictor *predictor,
#ifdef WITH_GPERFTOOLS
ProfilerStart("paddle_inference.prof");
#endif
int predicted_num = 0;
if (!FLAGS_zero_copy) {
run_timer.tic();
for (int i = 0; i < iterations; i++) {
run_timer.tic();
for (int j = 0; j < num_times; j++) {
predictor->Run(inputs[i], &(*outputs)[i], FLAGS_batch_size);
}
elapsed_time += run_timer.toc();
predicted_num += FLAGS_batch_size;
if (predicted_num % 100 == 0) {
LOG(INFO) << predicted_num << " samples";
}
}
elapsed_time = run_timer.toc();
} else {
for (int i = 0; i < iterations; i++) {
ConvertPaddleTensorToZeroCopyTensor(predictor, inputs[i]);
@ -352,8 +358,14 @@ void PredictionRun(PaddlePredictor *predictor,
predictor->ZeroCopyRun();
}
elapsed_time += run_timer.toc();
predicted_num += FLAGS_batch_size;
if (predicted_num % 100 == 0) {
LOG(INFO) << predicted_num << " samples";
}
}
}
#ifdef WITH_GPERFTOOLS
ProfilerStop();
#endif

Loading…
Cancel
Save