
"""simple docstring"""




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


A__      :	Dict          =    logging.get_logger(__name__)







class   _lowercase						(       lowerCAmelCase_				):


     '''simple docstring'''





     _A								=							'timm_backbone'



     def __init__(      self ,			__UpperCamelCase=None ,			__UpperCamelCase=3 ,			__UpperCamelCase=True ,			__UpperCamelCase=True ,			__UpperCamelCase=None ,			**__UpperCamelCase ,			)->					Union[str, Any]:

          '''simple docstring'''





          super().__init__(**__A  )
          UpperCAmelCase__							: Optional[int] 							=						backbone
          UpperCAmelCase__							: Any 							=						num_channels
          UpperCAmelCase__							: Tuple 							=						features_only
          UpperCAmelCase__							: Optional[Any] 							=						use_pretrained_backbone
          UpperCAmelCase__							: Optional[int] 							=						True
          UpperCAmelCase__							: List[str] 							=						out_indices if out_indices is not None else (-1,)





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


     '''simple docstring'''





     @register_to_config
     def __init__(      self ,			__UpperCamelCase = 7_68 ,			)->					Union[str, Any]:
          super().__init__()

          UpperCAmelCase__							: str 							=						nn.Parameter(torch.zeros(1 ,			__UpperCamelCase  )  )
          UpperCAmelCase__							: Optional[int] 							=						nn.Parameter(torch.ones(1 ,			__UpperCamelCase  )  )



     def  lowerCAmelCase__       (      self ,			__UpperCamelCase = None ,			__UpperCamelCase = None ,			)->					Any:
          UpperCAmelCase__							: Dict 							=						nn.Parameter(self.mean.to(__UpperCamelCase  ).to(__UpperCamelCase  )  )
          UpperCAmelCase__							: Any 							=						nn.Parameter(self.std.to(__UpperCamelCase  ).to(__UpperCamelCase  )  )
          return self



     def  lowerCAmelCase__       (      self ,			__UpperCamelCase  )->					Union[str, Any]:
          UpperCAmelCase__							: Dict 							=						(embeds - self.mean) * 1.0 / self.std
          return embeds



     def  lowerCAmelCase__       (      self ,			__UpperCamelCase  )->					List[Any]:
          UpperCAmelCase__							: Any 							=						(embeds * self.std) + self.mean
          return embeds



