From 8aff66543ada24e24205737b9578f9e678a5a0a4 Mon Sep 17 00:00:00 2001 From: Channingss Date: Thu, 14 Jan 2021 07:01:45 +0000 Subject: [PATCH] conv2dtanspose out_size to out_padding --- x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py b/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py index 740c387..50ea9a7 100644 --- a/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py +++ b/x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py @@ -1748,16 +1748,19 @@ class OpSet9(): output_size[1] = (val_x.out_shapes[0][3] - 1 ) * strides[1] - 2 * paddings[1] + dilations[1] * ( kernel_shape[1] - 1) + 1 + out_padding[1] + output_padding = # Conv2DTranspose缺少output_size,只能在forward里头传进output_size inputs_dict = {'x': val_x if isinstance(val_x, str) else val_x.name} layer_attrs = { "in_channels": num_in_channels, "out_channels": num_out_channels, - 'kernel_size': kernel_shape, + "kernel_size": kernel_shape, "stride": strides, "dilation": dilations, "padding": paddings, - "groups": num_groups} + "groups": num_groups, + "output_padding":out_padding} + self.weights[op_name + '.weight'] = self.weights[val_w.name] if val_b is not None: self.weights[op_name + '.bias'] = self.weights[val_b.name] -- GitLab