diff --git a/paddle/fluid/inference/tensorrt/engine.h b/paddle/fluid/inference/tensorrt/engine.h index 421842cf563db0212f1bb0621fb7a819f9423d3f..aa5a7657e28cd5d52a957788eb6c0d9008711b5b 100644 --- a/paddle/fluid/inference/tensorrt/engine.h +++ b/paddle/fluid/inference/tensorrt/engine.h @@ -358,7 +358,9 @@ class TensorRTEngine { bool WithFp16() { bool enable_fp16 = (precision_ == AnalysisConfig::Precision::kHalf); bool support_fp16 = infer_builder_->platformHasFastFp16(); - return enable_fp16 && support_fp16; + // below is consistent with setFlag in engine.cc + bool fall_back_fp16 = WithInt8() && !use_dla_; + return (enable_fp16 || fall_back_fp16) && support_fp16; } bool WithInt8() {