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'):
    Validator.check_value_type('kernel_size', kernel_size, [int], self.cls_name)
    Validator.check_value_type('stride', stride, [int], self.cls_name)
    Validator.check_value_type('padding', padding, [int], self.cls_name)
    Validator.check_value_type('dilation', dilation, [int], self.cls_name)
    Validator.check_integer('kernel_size', kernel_size, 1, Rel.GE, self.cls_name)
    Validator.check_integer('stride', stride, 1, Rel.GE, self.cls_name)
    Validator.check_integer('padding', padding, 0, Rel.GE, self.cls_name)
    Validator.check_integer('dilation', dilation, 1, Rel.GE, self.cls_name)
    kernel_size = (1, kernel_size)
    stride = (1, stride)
    dilation = (1, dilation)
    get_shape = P.Shape()
    get_dtype = P.DType()
    if isinstance(weight_init, Tensor):
        weight_init_shape = get_shape(weight_init)
        Validator.check_integer('weight_init_shape', len(weight_init_shape), 3, Rel.EQ, self.cls_name)
        weight_init_dtype = get_dtype(weight_init)
        weight_init_value = weight_init.asnumpy()
        weight_init_value = np.expand_dims(weight_init_value, 2)
        weight_init = Tensor(weight_init_value, weight_init_dtype)
    super(Conv1dTranspose, self).__init__(in_channels, out_channels, kernel_size, stride, pad_mode, padding, dilation, group, has_bias, weight_init, bias_init, transposed=True)
    self.padding = (0, 0, padding, padding)
    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 'Conv1dTranspose' 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=self.padding, stride=stride, dilation=dilation, group=group)
    self.bias_add = P.BiasAdd()
    self.expand_dims = P.ExpandDims()
    self.squeeze = P.Squeeze(2)
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'):
    Validator.check_value_type('kernel_size', kernel_size, [int], self.cls_name)
    Validator.check_value_type('stride', stride, [int], self.cls_name)
    Validator.check_value_type('padding', padding, [int], self.cls_name)
    Validator.check_value_type('dilation', dilation, [int], self.cls_name)
    Validator.check_integer('kernel_size', kernel_size, 1, Rel.GE, self.cls_name)
    Validator.check_integer('stride', stride, 1, Rel.GE, self.cls_name)
    Validator.check_integer('padding', padding, 0, Rel.GE, self.cls_name)
    Validator.check_integer('dilation', dilation, 1, Rel.GE, self.cls_name)
    kernel_size = (1, kernel_size)
    stride = (1, stride)
    dilation = (1, dilation)
    get_shape = P.Shape()
    get_dtype = P.DType()
    if isinstance(weight_init, Tensor):
        weight_init_shape = get_shape(weight_init)
        Validator.check_integer('weight_init_shape', len(weight_init_shape), 3, Rel.EQ, self.cls_name)
        weight_init_dtype = get_dtype(weight_init)
        weight_init_value = weight_init.asnumpy()
        weight_init_value = np.expand_dims(weight_init_value, 2)
        weight_init = Tensor(weight_init_value, weight_init_dtype)
    super(Conv1dTranspose, self).__init__(in_channels, out_channels, kernel_size, stride, pad_mode, padding, dilation, group, has_bias, weight_init, bias_init, transposed=True)
    self.padding = (0, 0, padding, padding)
    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 'Conv1dTranspose' 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=self.padding, stride=stride, dilation=dilation, group=group)
    self.bias_add = P.BiasAdd()
    self.expand_dims = P.ExpandDims()
    self.squeeze = P.Squeeze(2)