Skip to content

Commit fcf0c12

Browse files
committed
fix the input tensor type issue
1 parent 5a2213e commit fcf0c12

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

py/torch_tensorrt/dynamo/conversion/impl/quantize.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def quantize(
2828
"""
2929

3030
with unset_fake_temporarily():
31+
if not isinstance(input_tensor, TRTTensor):
32+
input_tensor = get_trt_tensor(ctx, input_tensor, name + "_quantize_input")
3133
if isinstance(input_tensor, TRTTensor) and input_tensor.dtype not in (
3234
trt.float32,
3335
trt.float16,
@@ -88,6 +90,10 @@ def dynamic_block_quantize(
8890
"""
8991

9092
with unset_fake_temporarily():
93+
if not isinstance(input_tensor, TRTTensor):
94+
input_tensor = get_trt_tensor(
95+
ctx, input_tensor, name + "_dynamic_quantize_input"
96+
)
9197
if isinstance(input_tensor, TRTTensor) and input_tensor.dtype not in (
9298
trt.float32,
9399
trt.float16,

0 commit comments

Comments
 (0)