Skip to content

fix: Cherry-pick acc convolution fix to release/1.4 #1910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions py/torch_tensorrt/fx/converters/acc_ops_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def acc_ops_conv1d(
# right now
if kwargs["bias"] is not None and not isinstance(kwargs["bias"], torch.Tensor):
raise RuntimeError(
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tenosr]"
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tensor]"
)
bias = to_numpy(kwargs["bias"]) # type: ignore[arg-type]
if bias is not None:
Expand Down Expand Up @@ -146,7 +146,7 @@ def acc_ops_conv1d(
else:
if not isinstance(kwargs["weight"], torch.Tensor):
raise RuntimeError(
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tenosr]"
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tensor]"
)
weight = to_numpy(weight)
weight = np.expand_dims(weight, -1)
Expand Down Expand Up @@ -202,11 +202,11 @@ def acc_ops_convnd(
# right now
if kwargs["bias"] is not None and not isinstance(kwargs["bias"], torch.Tensor):
raise RuntimeError(
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tenosr]"
f"linear {name} has bias of type {type(kwargs['bias'])}, Expect Optional[Tensor]"
)
bias = to_numpy(kwargs["bias"]) # type: ignore[arg-type]

if network.has_explicit_precision:
if network.has_explicit_precision or isinstance(kwargs["weight"], TRTTensor):
weight = get_trt_tensor(network, kwargs["weight"], f"{name}_weight")
weight_shape = tuple(kwargs["weight"].shape) # type: ignore[union-attr]
# will need to use uninitialized weight and set it later to support
Expand All @@ -224,7 +224,7 @@ def acc_ops_convnd(
else:
if not isinstance(kwargs["weight"], torch.Tensor):
raise RuntimeError(
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tenosr]"
f"linear {name} has weight of type {type(kwargs['weight'])}, Expect Optional[Tensor]"
)
weight = to_numpy(kwargs["weight"])
layer = network.add_convolution_nd(
Expand Down Expand Up @@ -276,7 +276,7 @@ def acc_ops_conv_transposend(
)
bias = to_numpy(kwargs["bias"]) # type: ignore[arg-type]

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