diff --git a/paddle/fluid/inference/tensorrt/convert/op_converter.h b/paddle/fluid/inference/tensorrt/convert/op_converter.h index 25af70f9d9cea0629f01a97b0dfe15019770dbbc..018e3d2bb77e0b22a600174aa9c2c4a0dbb8241f 100644 --- a/paddle/fluid/inference/tensorrt/convert/op_converter.h +++ b/paddle/fluid/inference/tensorrt/convert/op_converter.h @@ -359,7 +359,7 @@ class OpConverter { platform::errors::InvalidArgument( "The output tensor in TensorRT subgraph should be LoDTensor")); nvinfer1::DataType out_dtype = FluidDataType2TRT(var->GetDataType()); - if (engine->WithFp16() && !engine->WithInt8() && + if (engine->precision() == phi::DataType::FLOAT16 && out_dtype == nvinfer1::DataType::kFLOAT && engine->EnableLowPrecisionIO()) { out_dtype = nvinfer1::DataType::kHALF;