Skip to content

Commit 8dcb030

Browse files
authored
fix: Cherry-pick acc convolution fix to release/1.4 (#1910)
1 parent 40dfa81 commit 8dcb030

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

py/torch_tensorrt/fx/converters/acc_ops_converters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def acc_ops_conv1d(
116116
# right now
117117
if kwargs["bias"] is not None and not isinstance(kwargs["bias"], torch.Tensor):
118118
raise RuntimeError(
119-
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tenosr]"
119+
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tensor]"
120120
)
121121
bias = to_numpy(kwargs["bias"]) # type: ignore[arg-type]
122122
if bias is not None:
@@ -146,7 +146,7 @@ def acc_ops_conv1d(
146146
else:
147147
if not isinstance(kwargs["weight"], torch.Tensor):
148148
raise RuntimeError(
149-
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tenosr]"
149+
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tensor]"
150150
)
151151
weight = to_numpy(weight)
152152
weight = np.expand_dims(weight, -1)
@@ -202,11 +202,11 @@ def acc_ops_convnd(
202202
# right now
203203
if kwargs["bias"] is not None and not isinstance(kwargs["bias"], torch.Tensor):
204204
raise RuntimeError(
205-
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tenosr]"
205+
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tensor]"
206206
)
207207
bias = to_numpy(kwargs["bias"]) # type: ignore[arg-type]
208208

209-
if network.has_explicit_precision:
209+
if network.has_explicit_precision or isinstance(kwargs["weight"], TRTTensor):
210210
weight = get_trt_tensor(network, kwargs["weight"], f"{name}_weight")
211211
weight_shape = tuple(kwargs["weight"].shape) # type: ignore[union-attr]
212212
# will need to use uninitialized weight and set it later to support
@@ -224,7 +224,7 @@ def acc_ops_convnd(
224224
else:
225225
if not isinstance(kwargs["weight"], torch.Tensor):
226226
raise RuntimeError(
227-
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tenosr]"
227+
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tensor]"
228228
)
229229
weight = to_numpy(kwargs["weight"])
230230
layer = network.add_convolution_nd(
@@ -276,7 +276,7 @@ def acc_ops_conv_transposend(
276276
)
277277
bias = to_numpy(kwargs["bias"]) # type: ignore[arg-type]
278278

279-
if network.has_explicit_precision:
279+
if network.has_explicit_precision or isinstance(kwargs["weight"], TRTTensor):
280280
weight = get_trt_tensor(network, kwargs["weight"], f"{name}_weight")
281281
weight_shape = tuple(kwargs["weight"].shape) # type: ignore[union-attr]
282282
# will need to use uninitialized weight and set it later to support

0 commit comments

Comments
 (0)