'''simple docstring'''


from ...configuration_utils import PretrainedConfig
from ...utils import logging


snake_case__					:      Optional[Any]				      =  logging.get_logger(__name__)

snake_case__					:      Optional[Any]				      =  {
    '''microsoft/cvt-13''': '''https://huggingface.co/microsoft/cvt-13/resolve/main/config.json''',
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}






class 					__SCREAMING_SNAKE_CASE						(	lowerCamelCase_	):







  '''simple docstring'''






  lowerCamelCase_		:Dict						   =		'''cvt'''


  def __init__(			self				,		snake_case_=3				,		snake_case_=[7, 3, 3]				,		snake_case_=[4, 2, 2]				,		snake_case_=[2, 1, 1]				,		snake_case_=[6_4, 1_9_2, 3_8_4]				,		snake_case_=[1, 3, 6]				,		snake_case_=[1, 2, 1_0]				,		snake_case_=[4.0, 4.0, 4.0]				,		snake_case_=[0.0, 0.0, 0.0]				,		snake_case_=[0.0, 0.0, 0.0]				,		snake_case_=[0.0, 0.0, 0.1]				,		snake_case_=[True, True, True]				,		snake_case_=[False, False, True]				,		snake_case_=["dw_bn", "dw_bn", "dw_bn"]				,		snake_case_=[3, 3, 3]				,		snake_case_=[1, 1, 1]				,		snake_case_=[2, 2, 2]				,		snake_case_=[1, 1, 1]				,		snake_case_=[1, 1, 1]				,		snake_case_=0.02				,		snake_case_=1E-12				,		**snake_case_				,		):




       '''simple docstring'''

       super().__init__(**snake_case_						)
       UpperCAmelCase_							:       Optional[Any]       =				num_channels
       UpperCAmelCase_							:       Dict       =				patch_sizes
       UpperCAmelCase_							:       Tuple       =				patch_stride
       UpperCAmelCase_							:       str       =				patch_padding
       UpperCAmelCase_							:       int       =				embed_dim
       UpperCAmelCase_							:       Optional[Any]       =				num_heads
       UpperCAmelCase_							:       Dict       =				depth
       UpperCAmelCase_							:       Tuple       =				mlp_ratio
       UpperCAmelCase_							:       Tuple       =				attention_drop_rate
       UpperCAmelCase_							:       Dict       =				drop_rate
       UpperCAmelCase_							:       List[Any]       =				drop_path_rate
       UpperCAmelCase_							:       List[str]       =				qkv_bias
       UpperCAmelCase_							:       Optional[Any]       =				cls_token
       UpperCAmelCase_							:       List[Any]       =				qkv_projection_method
       UpperCAmelCase_							:       Dict       =				kernel_qkv
       UpperCAmelCase_							:       Optional[int]       =				padding_kv
       UpperCAmelCase_							:       str       =				stride_kv
       UpperCAmelCase_							:       List[Any]       =				padding_q
       UpperCAmelCase_							:       List[str]       =				stride_q
       UpperCAmelCase_							:       List[Any]       =				initializer_range
       UpperCAmelCase_							:       Union[str, Any]       =				layer_norm_eps







'''simple docstring'''


from typing import Optional, Union

import torch
from torch import nn

from ...configuration_utils import ConfigMixin, register_to_config
from ...models.modeling_utils import ModelMixin






class 					__SCREAMING_SNAKE_CASE						(	lowerCamelCase_						,     lowerCamelCase_	):







  '''simple docstring'''






  @register_to_config
  def __init__(			self				,		snake_case_ = 7_6_8				,		):




       '''simple docstring'''

       super().__init__()

       UpperCAmelCase_							:       int       =				nn.Parameter(torch.zeros(1				,		snake_case_						)						)
       UpperCAmelCase_							:       str       =				nn.Parameter(torch.ones(1				,		snake_case_						)						)


  def _UpperCamelCase					(			self				,		snake_case_ = None				,		snake_case_ = None				,		):




       '''simple docstring'''

       UpperCAmelCase_							:       int       =				nn.Parameter(self.mean.to(snake_case_						).to(snake_case_						)						)
       UpperCAmelCase_							:       Tuple       =				nn.Parameter(self.std.to(snake_case_						).to(snake_case_						)						)
       return self


  def _UpperCamelCase					(			self				,		snake_case_						):




       '''simple docstring'''

       UpperCAmelCase_							:       Dict       =				(embeds - self.mean) * 1.0 / self.std
       return embeds






  def _UpperCamelCase					(			self				,		snake_case_						):




       '''simple docstring'''

       UpperCAmelCase_							:       List[Any]       =				(embeds * self.std) + self.mean
       return embeds






