def __init__(self, in_channels, out_channels, kernel_size, stride=1, pad_mode='same', padding=0, dilation=1, group=1, has_bias=False, weight_init='normal', bias_init='zeros'):
    kernel_size = twice(kernel_size)
    stride = twice(stride)
    dilation = twice(dilation)
    Validator.check_value_type('padding', padding, (int, tuple), self.cls_name)
    if isinstance(padding, tuple):
        Validator.check_integer('padding size', len(padding), 4, Rel.EQ, self.cls_name)
    super(Conv2dTranspose, self).__init__(in_channels, out_channels, kernel_size, stride, pad_mode, padding, dilation, group, has_bias, weight_init, bias_init, transposed=True)
    self.in_channels = in_channels
    self.out_channels = out_channels
    self.shape = P.Shape()
    if (pad_mode not in ('valid', 'same', 'pad')):
        raise ValueError((("Attr 'pad_mode' of 'Conv2dTranspose' Op passed " + str(pad_mode)) + ", should be one of values in 'valid', 'same', 'pad'."))
    self.is_valid = (self.pad_mode == 'valid')
    self.is_same = (self.pad_mode == 'same')
    self.is_pad = (self.pad_mode == 'pad')
    if check_bool(has_bias):
        self.bias = Parameter(initializer(bias_init, [out_channels]), name='bias')
    self.conv2d_transpose = P.Conv2DBackpropInput(out_channel=in_channels, kernel_size=kernel_size, mode=1, pad_mode=pad_mode, pad=padding, stride=stride, dilation=dilation, group=group)
    self.bias_add = P.BiasAdd()
    if isinstance(self.padding, int):
        (self.padding_top, self.padding_bottom, self.padding_left, self.padding_right) = ((self.padding,) * 4)
    else:
        (self.padding_top, self.padding_bottom, self.padding_left, self.padding_right) = self.padding
def __init__(self, in_channels, out_channels, kernel_size, stride=1, pad_mode='same', padding=0, dilation=1, group=1, has_bias=False, weight_init='normal', bias_init='zeros'):
    kernel_size = twice(kernel_size)
    stride = twice(stride)
    dilation = twice(dilation)
    Validator.check_value_type('padding', padding, (int, tuple), self.cls_name)
    if isinstance(padding, tuple):
        Validator.check_integer('padding size', len(padding), 4, Rel.EQ, self.cls_name)
    super(Conv2dTranspose, self).__init__(in_channels, out_channels, kernel_size, stride, pad_mode, padding, dilation, group, has_bias, weight_init, bias_init, transposed=True)
    self.in_channels = in_channels
    self.out_channels = out_channels
    self.shape = P.Shape()
    if (pad_mode not in ('valid', 'same', 'pad')):
        raise ValueError((("Attr 'pad_mode' of 'Conv2dTranspose' Op passed " + str(pad_mode)) + ", should be one of values in 'valid', 'same', 'pad'."))
    self.is_valid = (self.pad_mode == 'valid')
    self.is_same = (self.pad_mode == 'same')
    self.is_pad = (self.pad_mode == 'pad')
    if check_bool(has_bias):
        self.bias = Parameter(initializer(bias_init, [out_channels]), name='bias')
    self.conv2d_transpose = P.Conv2DBackpropInput(out_channel=in_channels, kernel_size=kernel_size, mode=1, pad_mode=pad_mode, pad=padding, stride=stride, dilation=dilation, group=group)
    self.bias_add = P.BiasAdd()
    if isinstance(self.padding, int):
        (self.padding_top, self.padding_bottom, self.padding_left, self.padding_right) = ((self.padding,) * 4)
    else:
        (self.padding_top, self.padding_bottom, self.padding_left, self.padding_right) = self.padding