@@ -46,7 +46,6 @@ def _test_torch_model_single_io(torch_model, torch_input_shape, coreml_input_sha
46
46
47
47
# convert to coreml and run
48
48
coreml_model = convert (onnx_model , target_ios = target_ios )
49
-
50
49
output_name = [o .name for o in onnx_model .graph .output ][0 ]
51
50
initializer_names = {t .name for t in onnx_model .graph .initializer }
52
51
input_name = [i .name for i in onnx_model .graph .input if i .name not in initializer_names ][0 ]
@@ -157,15 +156,29 @@ def test_conv2D_transpose(self): # type: () -> None
157
156
class Net (nn .Module ):
158
157
def __init__ (self ):
159
158
super (Net , self ).__init__ ()
160
- self .convT = torch .nn .ConvTranspose2d (1 , 1 , kernel_size = 3 , stride = 2 , output_padding = 1 , padding = 1 , groups = 1 )
159
+ self .convT = torch .nn .ConvTranspose2d (1 , 1 , kernel_size = 3 , stride = 2 , output_padding = 0 , padding = 3 , groups = 1 )
160
+
161
+ def forward (self , x ):
162
+ y = self .convT (x )
163
+ return y
164
+
165
+ torch_model = Net () # type: ignore
166
+ torch_model .train (False )
167
+ _test_torch_model_single_io (torch_model , (1 , 1 , 64 , 64 ), (1 , 64 , 64 )) # type: ignore
168
+
169
+ def test_conv2D_transpose_output_padding (self ): # type: () -> None
170
+ class Net (nn .Module ):
171
+ def __init__ (self ):
172
+ super (Net , self ).__init__ ()
173
+ self .convT = torch .nn .ConvTranspose2d (1 , 1 , kernel_size = 3 , stride = 2 , output_padding = 1 , padding = 3 , groups = 1 )
161
174
162
175
def forward (self , x ):
163
176
y = self .convT (x )
164
177
return y
165
178
166
179
torch_model = Net () # type: ignore
167
180
torch_model .train (False )
168
- _test_torch_model_single_io (torch_model , (1 , 1 , 2 , 2 ), (1 , 2 , 2 )) # type: ignore
181
+ _test_torch_model_single_io (torch_model , (1 , 1 , 64 , 64 ), (1 , 64 , 64 )) # type: ignore
169
182
170
183
def test_conv2D_transpose_groups (self ): # type: () -> None
171
184
class Net (nn .Module ):
0 commit comments