diff --git a/paddle/fluid/inference/tests/api/CMakeLists.txt b/paddle/fluid/inference/tests/api/CMakeLists.txt index 925c3e6b879b56ab158e983032efbbc673357eba..70f9e397c96cf3fe92779778950f3df71b5a67c9 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 cb6c2991e4229e371ae4a37a963601da1fd57fd2..bf320a0cbc2fff5f973c48768281e26d0fde232b 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;