Merge pull request #25766 from trevor-m:tmorris_tftrt_fp16mode
PiperOrigin-RevId: 234217906
This commit is contained in:
commit
e2a04a904c
@ -3883,8 +3883,12 @@ tensorflow::Status ConvertGraphDefToEngine(
|
|||||||
builder->setMaxWorkspaceSize(max_workspace_size_bytes);
|
builder->setMaxWorkspaceSize(max_workspace_size_bytes);
|
||||||
builder->setGpuAllocator(allocator);
|
builder->setGpuAllocator(allocator);
|
||||||
if (precision_mode == TrtPrecisionMode::FP16) {
|
if (precision_mode == TrtPrecisionMode::FP16) {
|
||||||
builder->setHalf2Mode(true);
|
builder->setFp16Mode(true);
|
||||||
} else if (precision_mode == TrtPrecisionMode::INT8) {
|
} 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 or where INT8 is
|
||||||
|
// not supported for a given layer.
|
||||||
|
builder->setFp16Mode(true);
|
||||||
builder->setInt8Mode(true);
|
builder->setInt8Mode(true);
|
||||||
if (use_calibration) {
|
if (use_calibration) {
|
||||||
builder->setInt8Calibrator(calibrator);
|
builder->setInt8Calibrator(calibrator);
|
||||||
|
Loading…
Reference in New Issue
Block a user