From 6c81230683e343c2e631b94e51ea89fd9103b463 Mon Sep 17 00:00:00 2001 From: nhzlx Date: Wed, 26 Sep 2018 03:22:33 +0000 Subject: [PATCH] update code for config change test=develop --- paddle/fluid/inference/tests/api/CMakeLists.txt | 4 +++- paddle/fluid/inference/tests/api/trt_models_tester.cc | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/inference/tests/api/CMakeLists.txt b/paddle/fluid/inference/tests/api/CMakeLists.txt index 925c3e6b879..70f9e397c96 100644 --- a/paddle/fluid/inference/tests/api/CMakeLists.txt +++ b/paddle/fluid/inference/tests/api/CMakeLists.txt @@ -93,7 +93,9 @@ endif() if(WITH_GPU AND TENSORRT_FOUND) set(TRT_MODEL_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/trt") - inference_download_and_uncompress(${TRT_MODEL_INSTALL_DIR} ${INFERENCE_URL}/tensorrt_test "trt_test_models.tar.gz") + if (NOT EXISTS ${TRT_MODEL_INSTALL_DIR}) + inference_download_and_uncompress(${TRT_MODEL_INSTALL_DIR} ${INFERENCE_URL}/tensorrt_test "trt_test_models.tar.gz") + endif() cc_test(test_trt_models SRCS trt_models_tester.cc ARGS --dirname=${TRT_MODEL_INSTALL_DIR}/trt_test_models DEPS paddle_inference_tensorrt_subgraph_engine) diff --git a/paddle/fluid/inference/tests/api/trt_models_tester.cc b/paddle/fluid/inference/tests/api/trt_models_tester.cc index cb6c2991e42..bf320a0cbc2 100644 --- a/paddle/fluid/inference/tests/api/trt_models_tester.cc +++ b/paddle/fluid/inference/tests/api/trt_models_tester.cc @@ -19,6 +19,7 @@ #include "paddle/fluid/inference/api/paddle_inference_api.h" namespace paddle { +using paddle::contrib::MixedRTConfig; DEFINE_string(dirname, "", "Directory of the inference model."); @@ -32,8 +33,8 @@ NativeConfig GetConfigNative() { return config; } -TensorRTConfig GetConfigTRT() { - TensorRTConfig config; +MixedRTConfig GetConfigTRT() { + MixedRTConfig config; config.model_dir = FLAGS_dirname; config.use_gpu = true; config.fraction_of_gpu_memory = 0.2; @@ -46,14 +47,14 @@ void CompareTensorRTWithFluid(int batch_size, std::string model_dirname) { NativeConfig config0 = GetConfigNative(); config0.model_dir = model_dirname; - TensorRTConfig config1 = GetConfigTRT(); + MixedRTConfig config1 = GetConfigTRT(); config1.model_dir = model_dirname; config1.max_batch_size = batch_size; auto predictor0 = CreatePaddlePredictor(config0); auto predictor1 = - CreatePaddlePredictor(config1); // Prepare inputs int height = 224; -- GitLab