There was an error while loading. Please reload this page.
1 parent a93266a commit 8e06793Copy full SHA for 8e06793
3 files changed
py/torch_tensorrt/dynamo/conversion/impl/conv.py
@@ -11,7 +11,6 @@
11
from torch_tensorrt.dynamo.conversion.converter_utils import (
12
SourceIR,
13
cast_trt_tensor,
14
- extend_attr_to_tuple,
15
get_trt_tensor,
16
has_dynamic_shape,
17
set_layer_name,
@@ -159,10 +158,9 @@ def convNd(
159
158
# Expand parameters manually for Conv1D computations
160
if is_conv1d:
161
padding = (tuple(padding) + (0,)) if padding is not None else padding
162
- stride = extend_attr_to_tuple(stride, 2) if stride is not None else stride
163
- dilation = (
164
- extend_attr_to_tuple(dilation, 2) if dilation is not None else dilation
165
- )
+ # stride in conv1d is (2,) -> need to change to (2, 1) in conv2d
+ stride = (stride[0], 1) if stride is not None else stride
+ dilation = (dilation[0], 1) if dilation is not None else dilation
166
167
# Set relevant attributes of convolution layer
168
if padding is not None:
py/torch_tensorrt/dynamo/conversion/impl/deconv.py
@@ -10,7 +10,6 @@
10
from torch_tensorrt.dynamo.conversion._ConversionContext import ConversionContext
to_torch,
@@ -142,10 +141,9 @@ def deconvNd(
142
141
143
if is_deconv1d:
144
145
146
147
148
+ # stride in deconv1d is (2,) -> need to change to (2, 1) in deconv2d
149
output_padding = (
150
(tuple(output_padding) + (0,))
151
if output_padding is not None
tests/py/dynamo/conversion/test_convolution_aten.py
@@ -15,6 +15,9 @@ class TestConvolutionConverter(DispatchTestCase):
param("non_zero_padding", 1, padding=1),
param("dilation", 1, dilation=2),
param("groups", 1, groups=3),
18
+ param("stride", 1, stride=1),
19
+ param("stride_2", 1, stride=2),
20
+ param("stride_tuple", 1, stride=(2,)),
21
]
22
)
23
def test_conv1d(
@@ -52,6 +55,7 @@ def forward(self, x):
52
55
("tuple_parameters", 1, (1), (1)),
53
56
54
57
58
+ param("stride", 1, stride=2),
59
60
61
def test_conv1d_TRTTensor_weight(
@@ -140,6 +144,7 @@ def forward(self, x):
140
param("tuple_dilation", 2, dilation=(3, 3)),
param("list_dilation", 2, dilation=[3]),
+ param("stride", 1, stride=(2, 2)),
def test_conv2d(
0 commit comments