| 18 | namespace inference { |
| 19 | |
| 20 | TEST(TensorRT, disable_tensorrt_half_ops) { |
| 21 | std::string model_dir = FLAGS_infer_model + "/resnet50"; |
| 22 | AnalysisConfig config; |
| 23 | config.SetModel(model_dir); |
| 24 | config.EnableUseGpu(100, 0); |
| 25 | config.EnableTensorRtEngine( |
| 26 | 1 << 30, 1, 5, AnalysisConfig::Precision::kHalf, false, false); |
| 27 | |
| 28 | paddle_infer::experimental::InternalUtils::DisableTensorRtHalfOps(&config, |
| 29 | {"conv2d"}); |
| 30 | |
| 31 | std::vector<std::vector<PaddleTensor>> inputs_all; |
| 32 | auto predictor = CreatePaddlePredictor(config); |
| 33 | SetFakeImageInput(&inputs_all, model_dir, false, "__model__", ""); |
| 34 | |
| 35 | std::vector<PaddleTensor> outputs; |
| 36 | for (auto &input : inputs_all) { |
| 37 | ASSERT_TRUE(predictor->Run(input, &outputs)); |
| 38 | predictor->ClearIntermediateTensor(); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | } // namespace inference |
| 43 | } // namespace paddle |
nothing calls this directly
no test coverage detected