parameters: (self,
                   in_channels,
                   out_channels,
                   kernel_size,
                   stride=1,
                   pad_mode='same',
                   padding=0,
                   dilation=1,
                   group=1,
                   has_bias=False,
                   eps=1e-5,
                   momentum=0.997,
                   weight_init='normal',
                   bias_init='zeros',
                   quant_config=quant_config_default,
                   quant_dtype=QuantDtype.INT8)
docstring: Initialize Conv2dBnWithoutFoldQuant.
docstring_summary: Initialize Conv2dBnWithoutFoldQuant.
docstring_tokens: Initialize Conv2dBnWithoutFoldQuant .
function: def __init__(self,
                   in_channels,
                   out_channels,
                   kernel_size,
                   stride=1,
                   pad_mode='same',
                   padding=0,
                   dilation=1,
                   group=1,
                   has_bias=False,
                   eps=1e-5,
                   momentum=0.997,
                   weight_init='normal',
                   bias_init='zeros',
                   quant_config=quant_config_default,
                   quant_dtype=QuantDtype.INT8):
          """Initialize Conv2dBnWithoutFoldQuant."""
          super(Conv2dBnWithoutFoldQuant, self).__init__()
          self.in_channels = Validator.check_positive_int(in_channels, "in_channels", self.cls_name)
          self.out_channels = Validator.check_positive_int(out_channels, "out_channels", self.cls_name)
          self.has_bias = has_bias
          self.kernel_size = twice(kernel_size)
          self.stride = twice(stride)
          self.dilation = twice(dilation)
          for kernel_size_elem in self.kernel_size:
              Validator.check_positive_int(kernel_size_elem, 'kernel_size item', self.cls_name)
          for stride_elem in self.stride:
              Validator.check_positive_int(stride_elem, 'stride item', self.cls_name)
          for dilation_elem in self.dilation:
              Validator.check_positive_int(dilation_elem, 'dilation item', self.cls_name)
          if pad_mode not in ('valid', 'same', 'pad'):
              raise ValueError(f"For '{self.cls_name}', the 'pad_mode' should be one of values in "
                               f"('valid', 'same', 'pad'), but got {pad_mode}.")
          self.pad_mode = pad_mode
          if isinstance(padding, int):
              Validator.check_non_negative_int(padding, 'padding', self.cls_name)
              self.padding = padding
          elif isinstance(padding, tuple):
              for pad in padding:
                  Validator.check_non_negative_int(pad, 'padding item', self.cls_name)
              self.padding = padding
          else:
              raise TypeError(f"For '{self.cls_name}', the type of 'padding' must be int/tuple(int), "
                              f"but got {type(padding).__name__}!")
          self.group = Validator.check_positive_int(group, "group", self.cls_name)
          self.bias_add = P.BiasAdd()
          if Validator.check_bool(has_bias, "has_bias", self.cls_name):
              self.bias = Parameter(initializer(bias_init, [out_channels]), name='bias')
          else:
              self.bias = None
          # initialize convolution op and Parameter
          self.conv = P.Conv2D(out_channel=self.out_channels,
                               kernel_size=self.kernel_size,
                               mode=1,
                               pad_mode=self.pad_mode,
                               pad=self.padding,
                               stride=self.stride,
                               dilation=self.dilation,
                               group=self.group)
          weight_shape = [out_channels, in_channels // group, *self.kernel_size]
          channel_axis = 0
          self.weight = Parameter(initializer(weight_init, weight_shape), name='weight')
          self.fake_quant_weight = quant_config.weight(ema=False,
                                                       channel_axis=channel_axis,
                                                       num_channels=out_channels,
                                                       quant_dtype=quant_dtype)
          self.batchnorm = BatchNorm2d(out_channels, eps=eps, momentum=momentum)
function_tokens: def __init__ ( self , in_channels , out_channels , kernel_size , stride = 1 , pad_mode = 'same' , padding = 0 , dilation = 1 , group = 1 , has_bias = False , eps = 1e-5 , momentum = 0.997 , weight_init = 'normal' , bias_init = 'zeros' , quant_config = quant_config_default , quant_dtype = QuantDtype . INT8 ) : super ( Conv2dBnWithoutFoldQuant , self ) . __init__ ( ) self . in_channels = Validator . check_positive_int ( in_channels , "in_channels" , self . cls_name ) self . out_channels = Validator . check_positive_int ( out_channels , "out_channels" , self . cls_name ) self . has_bias = has_bias self . kernel_size = twice ( kernel_size ) self . stride = twice ( stride ) self . dilation = twice ( dilation ) for kernel_size_elem in self . kernel_size : Validator . check_positive_int ( kernel_size_elem , 'kernel_size item' , self . cls_name ) for stride_elem in self . stride : Validator . check_positive_int ( stride_elem , 'stride item' , self . cls_name ) for dilation_elem in self . dilation : Validator . check_positive_int ( dilation_elem , 'dilation item' , self . cls_name ) if pad_mode not in ( 'valid' , 'same' , 'pad' ) : raise ValueError ( f"For '{self.cls_name}', the 'pad_mode' should be one of values in " f"('valid', 'same', 'pad'), but got {pad_mode}." ) self . pad_mode = pad_mode if isinstance ( padding , int ) : Validator . check_non_negative_int ( padding , 'padding' , self . cls_name ) self . padding = padding elif isinstance ( padding , tuple ) : for pad in padding : Validator . check_non_negative_int ( pad , 'padding item' , self . cls_name ) self . padding = padding else : raise TypeError ( f"For '{self.cls_name}', the type of 'padding' must be int/tuple(int), " f"but got {type(padding).__name__}!" ) self . group = Validator . check_positive_int ( group , "group" , self . cls_name ) self . bias_add = P . BiasAdd ( ) if Validator . check_bool ( has_bias , "has_bias" , self . cls_name ) : self . bias = Parameter ( initializer ( bias_init , [ out_channels ] ) , name = 'bias' ) else : self . bias = None # initialize convolution op and Parameter self . conv = P . Conv2D ( out_channel = self . out_channels , kernel_size = self . kernel_size , mode = 1 , pad_mode = self . pad_mode , pad = self . padding , stride = self . stride , dilation = self . dilation , group = self . group ) weight_shape = [ out_channels , in_channels // group , * self . kernel_size ] channel_axis = 0 self . weight = Parameter ( initializer ( weight_init , weight_shape ) , name = 'weight' ) self . fake_quant_weight = quant_config . weight ( ema = False , channel_axis = channel_axis , num_channels = out_channels , quant_dtype = quant_dtype ) self . batchnorm = BatchNorm2d ( out_channels , eps = eps , momentum = momentum )