Skip to content

Commit 505f715

Browse files
committed
Fix: quantize custom ops only if int8 precision is indicated
Signed-off-by: Gwena Cunha <[email protected]>
1 parent e27a2b7 commit 505f715

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modelopt/onnx/trt_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,10 @@ def interpret_trt_plugins_precision_flag(
416416
# Will add Q/DQ nodes in the requested I/O indices
417417
inp_precision_quant = [i for i, p in enumerate(inp_precision) if p in ["int8", "fp8"]]
418418
out_precision_quant = [i for i, p in enumerate(out_precision) if p in ["int8", "fp8"]]
419-
custom_ops_to_quantize[op_type] = {
420-
"inp": inp_precision_quant,
421-
"out": out_precision_quant,
422-
}
419+
if inp_precision_quant or out_precision_quant:
420+
custom_ops_to_quantize[op_type] = {
421+
"inp": inp_precision_quant,
422+
"out": out_precision_quant,
423+
}
423424

424425
return custom_ops_to_cast, custom_ops_to_quantize

0 commit comments

Comments
 (0)