





'''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     :					Any					,				__a     :					int = 7_68					,				):
								super().__init__()

								_a								= nn.Parameter(torch.zeros(1					,				__a					)					)
								_a								= nn.Parameter(torch.ones(1					,				__a					)					)




				def   UpperCamelCase__   (  self     :					List[str]					,				__a     :					Optional[Union[str, torch.device]] = None					,				__a     :					Optional[torch.dtype] = None					,				):
								_a								= nn.Parameter(self.mean.to(__a					).to(__a					)					)
								_a								= nn.Parameter(self.std.to(__a					).to(__a					)					)
								return self




				def   UpperCamelCase__   (  self     :					Union[str, Any]					,				__a     :					int					):
								_a								= (embeds - self.mean) * 1.0 / self.std
								return embeds




				def   UpperCamelCase__   (  self     :					Optional[Any]					,				__a     :					Union[str, Any]					):
								_a								= (embeds * self.std) + self.mean
								return embeds





"""simple docstring"""

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowercase__    :  str							    =	{
    '''configuration_x_clip''': [
        '''XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''XCLIPConfig''',
        '''XCLIPTextConfig''',
        '''XCLIPVisionConfig''',
    ],
    '''processing_x_clip''': ['''XCLIPProcessor'''],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     lowercase__    :  Tuple							    =	[
         '''XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''XCLIPModel''',
         '''XCLIPPreTrainedModel''',
         '''XCLIPTextModel''',
         '''XCLIPVisionModel''',
     ]

if TYPE_CHECKING:
     from .configuration_x_clip import (
         XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
         XCLIPConfig,
         XCLIPTextConfig,
         XCLIPVisionConfig,
     )
     from .processing_x_clip import XCLIPProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_x_clip import (
              XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
              XCLIPModel,
              XCLIPPreTrainedModel,
              XCLIPTextModel,
              XCLIPVisionModel,
          )

else:
     import sys

     lowercase__    :  Tuple							    =	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





