@@ -22,7 +22,7 @@ def convert_Conv1d(ctx):
2222
2323 # reshape to 2D
2424 layer = ctx .network .add_shuffle (input_trt )
25- layer .reshape_dims = (- 1 , input .shape [- 1 ], 1 )
25+ layer .reshape_dims = (input . shape [ 0 ], - 1 , input .shape [- 1 ], 1 )
2626
2727 layer = ctx .network .add_convolution (
2828 input = layer .get_output (0 ),
@@ -39,26 +39,30 @@ def convert_Conv1d(ctx):
3939
4040 # reshape back to 1D
4141 layer = ctx .network .add_shuffle (layer .get_output (0 ))
42- layer .reshape_dims = (- 1 , output .shape [- 1 ])
42+ layer .reshape_dims = (input . shape [ 0 ], - 1 , output .shape [- 1 ])
4343
4444 output ._trt = layer .get_output (0 )
4545
4646
4747@add_module_test (torch .float32 , torch .device ('cuda' ), [(1 , 10 , 224 )])
48+ @add_module_test (torch .float32 , torch .device ('cuda' ), [(2 , 10 , 224 )], max_batch_size = 2 )
4849def test_Conv1d_basic ():
4950 return torch .nn .Conv1d (10 , 5 , kernel_size = 1 , stride = 1 , padding = 0 )
5051
5152
5253@add_module_test (torch .float32 , torch .device ('cuda' ), [(1 , 10 , 224 )])
54+ @add_module_test (torch .float32 , torch .device ('cuda' ), [(2 , 10 , 224 )], max_batch_size = 2 )
5355def test_Conv1d_stride2 ():
5456 return torch .nn .Conv1d (10 , 5 , kernel_size = 1 , stride = 2 , padding = 0 )
5557
5658
5759@add_module_test (torch .float32 , torch .device ('cuda' ), [(1 , 10 , 224 )])
60+ @add_module_test (torch .float32 , torch .device ('cuda' ), [(2 , 10 , 224 )], max_batch_size = 2 )
5861def test_Conv1d_kernel3 ():
5962 return torch .nn .Conv1d (10 , 5 , kernel_size = 3 , stride = 2 , padding = 1 )
6063
6164
6265@add_module_test (torch .float32 , torch .device ('cuda' ), [(1 , 10 , 224 )])
66+ @add_module_test (torch .float32 , torch .device ('cuda' ), [(2 , 10 , 224 )], max_batch_size = 2 )
6367def test_Conv1d_dilation2 ():
6468 return torch .nn .Conv1d (10 , 5 , kernel_size = 3 , stride = 1 , padding = 1 , dilation = 2 )
0 commit comments