






"""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    lowercase__			(							UpperCAmelCase__,   UpperCAmelCase__   ):


			@register_to_config
			def __init__(      self     :  Dict   ,       snake_case__     :  int = 768   ,       ):
										super().__init__()

										lowerCamelCase_       :							Union[str, Any]									=nn.Parameter(torch.zeros(1   ,       UpperCAmelCase__					)					)
										lowerCamelCase_       :							Any									=nn.Parameter(torch.ones(1   ,       UpperCAmelCase__					)					)


			def 	UpperCAmelCase__						(      self     :  Union[str, Any]   ,       snake_case__     :  Optional[Union[str, torch.device]] = None   ,       snake_case__     :  Optional[torch.dtype] = None   ,       ):
										lowerCamelCase_       :							Optional[Any]									=nn.Parameter(self.mean.to(UpperCAmelCase__					).to(UpperCAmelCase__					)					)
										lowerCamelCase_       :							str									=nn.Parameter(self.std.to(UpperCAmelCase__					).to(UpperCAmelCase__					)					)
										return self


			def 	UpperCAmelCase__						(      self     :  Tuple   ,       snake_case__     :  Tuple					):
										lowerCamelCase_       :							List[str]									=(embeds - self.mean) * 1.0 / self.std
										return embeds


			def 	UpperCAmelCase__						(      self     :  str   ,       snake_case__     :  Union[str, Any]					):
										lowerCamelCase_       :							Tuple									=(embeds * self.std) + self.mean
										return embeds









from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowerCamelCase	:		List[str]							       =   {"""configuration_vit_msn""": ["""VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTMSNConfig"""]}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCamelCase	:		List[Any]							       =   [
      """VIT_MSN_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """ViTMSNModel""",
      """ViTMSNForImageClassification""",
      """ViTMSNPreTrainedModel""",
  ]

if TYPE_CHECKING:
  from .configuration_vit_msn import VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTMSNConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_vit_msn import (
        VIT_MSN_PRETRAINED_MODEL_ARCHIVE_LIST,
        ViTMSNForImageClassification,
        ViTMSNModel,
        ViTMSNPreTrainedModel,
    )

else:
  import sys

  _lowerCamelCase	:		Tuple							       =   _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


