Skip to content

Commit

Permalink
minor fix and issue pytorch#2185
Browse files Browse the repository at this point in the history
  • Loading branch information
zewenli98 committed Aug 24, 2023
1 parent 9d52c6a commit adc7295
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions py/torch_tensorrt/dynamo/conversion/converter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ def extend_attr_to_tuple(
"""
if not isinstance(val, (tuple, list)):
val = (val,) * num_elem
elif len(val) == 1:
val = (val[0],) * num_elem

if isinstance(val, list):
val = tuple(val)
return val
4 changes: 2 additions & 2 deletions py/torch_tensorrt/dynamo/conversion/impl/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def convNd(
)

# Process bias terms
if isinstance(bias, torch.Tensor):
if isinstance(bias, (torch.Tensor, np.ndarray)):
# Transform the bias constant into a Numpy array
bias = to_numpy(bias)

Expand All @@ -67,7 +67,7 @@ def convNd(
network, target, (weight, -1), {}, name + "_unsqueeze_weight"
)

elif isinstance(weight, torch.Tensor):
elif isinstance(weight, (torch.Tensor, np.ndarray)):
# Transform the weight constant into a Numpy array
weight = to_numpy(weight)

Expand Down

0 comments on commit adc7295

Please sign in to comment.