


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


lowerCAmelCase__			:      Tuple								=logging.get_logger(__name__)

lowerCAmelCase__			:      Union[str, Any]								={
    'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json',
    # See all ViT MSN models at https://huggingface.co/models?filter=vit_msn
}







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""vit_msn"""






							def __init__(      self			,						lowerCAmelCase__=7_6_8			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=3_0_7_2			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=0.0			,						lowerCAmelCase__=0.0			,						lowerCAmelCase__=0.02			,						lowerCAmelCase__=1E-06			,						lowerCAmelCase__=2_2_4			,						lowerCAmelCase__=1_6			,						lowerCAmelCase__=3			,						lowerCAmelCase__=True			,						**lowerCAmelCase__			,						):





										"""simple docstring"""




										super().__init__(**lowerCAmelCase__       )

										SCREAMING_SNAKE_CASE_		:     Tuple					=					hidden_size
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					num_hidden_layers
										SCREAMING_SNAKE_CASE_		:     Tuple					=					num_attention_heads
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					intermediate_size
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					hidden_act
										SCREAMING_SNAKE_CASE_		:     List[str]					=					hidden_dropout_prob
										SCREAMING_SNAKE_CASE_		:     Dict					=					attention_probs_dropout_prob
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					initializer_range
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					layer_norm_eps
										SCREAMING_SNAKE_CASE_		:     str					=					image_size
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					patch_size
										SCREAMING_SNAKE_CASE_		:     Any					=					num_channels
										SCREAMING_SNAKE_CASE_		:     int					=					qkv_bias












'''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   UpperCAmelCase      (			UpperCamelCase__     ,			UpperCamelCase__							):
 @register_to_config
 def __init__(							self :List[str]		,			lowercase_ :int = 7_68		,			)->				str:
     super().__init__()

     A__							=     nn.Parameter(torch.zeros(1		,			lowercase_				)				)
     A__							=     nn.Parameter(torch.ones(1		,			lowercase_				)				)
 def 	UpperCAmelCase_				(							self :List[Any]		,			lowercase_ :Optional[Union[str, torch.device]] = None		,			lowercase_ :Optional[torch.dtype] = None		,			)->				Tuple:
     A__							=     nn.Parameter(self.mean.to(lowercase_				).to(lowercase_				)				)
     A__							=     nn.Parameter(self.std.to(lowercase_				).to(lowercase_				)				)
     return self
 def 	UpperCAmelCase_				(							self :Optional[int]		,			lowercase_ :str				)->				Union[str, Any]:
     A__							=     (embeds - self.mean) * 1.0 / self.std
     return embeds



 def 	UpperCAmelCase_				(							self :Any		,			lowercase_ :List[Any]				)->				Tuple:
     A__							=     (embeds * self.std) + self.mean
     return embeds



