Change deprecated setHalf2Mode -> setFp16Mode. Also allow int8 mode to fp16 kernels when they are more performant.

This commit is contained in:
Trevor Morris 2019-02-14 11:20:58 -08:00
parent 3d89145866
commit b839268499

View File

@ -3770,8 +3770,11 @@ tensorflow::Status ConvertGraphDefToEngine(
builder->setMaxWorkspaceSize(max_workspace_size_bytes);
builder->setGpuAllocator(allocator);
if (precision_mode == TrtPrecisionMode::FP16) {
builder->setHalf2Mode(true);
builder->setFp16Mode(true);
} else if (precision_mode == TrtPrecisionMode::INT8) {
// Setting FP16 mode as well allows TRT to also consider FP16 kernels and
// use them in situations where they are faster than INT8.
builder->setFp16Mode(true);
builder->setInt8Mode(true);
if (use_calibration) {
builder->setInt8Calibrator(calibrator);