def __init__(self, in_channels, out_channels, kernel_size, group, stride=1, pad_mode='same', padding=0, dilation=1, has_bias=False, weight_init='normal', bias_init='zeros'):
    super(DepthwiseConv2d, self).__init__()
    self.kernel_size = twice(kernel_size)
    self.stride = twice(stride)
    self.dilation = twice(dilation)
    self.in_channels = check_int_positive(in_channels)
    self.out_channels = check_int_positive(out_channels)
    if (group is None):
        group = in_channels
    validator.check_integer('group', group, in_channels, Rel.EQ)
    validator.check_integer('group', group, out_channels, Rel.EQ)
    validator.check_integer('group', group, 1, Rel.GE)
    self.pad_mode = pad_mode
    self.dilation = dilation
    self.group = group
    self.has_bias = has_bias
    self.weight_init = weight_init
    self.bias_init = bias_init
    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)
    self.padding = padding
    self.conv = P.DepthwiseConv2dNative(channel_multiplier=1, kernel_size=self.kernel_size, pad_mode=self.pad_mode, pad=self.padding, stride=self.stride, dilation=self.dilation)
    self.bias_add = P.BiasAdd()
    weight_shape = [1, in_channels, *self.kernel_size]
    self.weight = Parameter(initializer(weight_init, weight_shape), name='weight')
    if check_bool(has_bias):
        self.bias = Parameter(initializer(bias_init, [out_channels]), name='bias')
    else:
        if (bias_init != 'zeros'):
            logger.warning('value of `has_bias` is False, value of `bias_init` will be ignore.')
        self.bias = None
def __init__(self, in_channels, out_channels, kernel_size, group, stride=1, pad_mode='same', padding=0, dilation=1, has_bias=False, weight_init='normal', bias_init='zeros'):
    super(DepthwiseConv2d, self).__init__()
    self.kernel_size = twice(kernel_size)
    self.stride = twice(stride)
    self.dilation = twice(dilation)
    self.in_channels = check_int_positive(in_channels)
    self.out_channels = check_int_positive(out_channels)
    if (group is None):
        group = in_channels
    validator.check_integer('group', group, in_channels, Rel.EQ)
    validator.check_integer('group', group, out_channels, Rel.EQ)
    validator.check_integer('group', group, 1, Rel.GE)
    self.pad_mode = pad_mode
    self.dilation = dilation
    self.group = group
    self.has_bias = has_bias
    self.weight_init = weight_init
    self.bias_init = bias_init
    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)
    self.padding = padding
    self.conv = P.DepthwiseConv2dNative(channel_multiplier=1, kernel_size=self.kernel_size, pad_mode=self.pad_mode, pad=self.padding, stride=self.stride, dilation=self.dilation)
    self.bias_add = P.BiasAdd()
    weight_shape = [1, in_channels, *self.kernel_size]
    self.weight = Parameter(initializer(weight_init, weight_shape), name='weight')
    if check_bool(has_bias):
        self.bias = Parameter(initializer(bias_init, [out_channels]), name='bias')
    else:
        if (bias_init != 'zeros'):
            logger.warning('value of `has_bias` is False, value of `bias_init` will be ignore.')
        self.bias = None