






from typing import List, Optional, Tuple, Union

from . import logging
from .import_utils import is_torch_available, is_torch_version


if is_torch_available():
      import torch

__UpperCAmelCase      =				logging.get_logger(__name__)  # pylint: disable=invalid-name

try:
      from torch._dynamo import allow_in_graph as maybe_allow_in_graph
except (ImportError, ModuleNotFoundError):





      def 						A_					(						cls			)				->List[Any]:







       """simple docstring"""

       return cls





def 						A_					(						lowercase_	,  lowercase_ = None	,  lowercase_ = None	,  lowercase_ = None	,  lowercase_ = None	,  )				->Optional[Any]:







 """simple docstring"""

 SCREAMING_SNAKE_CASE				    =		device
 SCREAMING_SNAKE_CASE				    =		shape[0]

 SCREAMING_SNAKE_CASE				    =		layout or torch.strided
 SCREAMING_SNAKE_CASE				    =		device or torch.device('cpu'			)

 if generator is not None:
  SCREAMING_SNAKE_CASE				    =		generator.device.type if not isinstance(lowercase_	,  lowercase_			) else generator[0].device.type
  if gen_device_type != device.type and gen_device_type == "cpu":
   SCREAMING_SNAKE_CASE				    =		'cpu'
   if device != "mps":
    logger.info(
        f'''The passed generator was created on \'cpu\' even though a tensor on {device} was expected.'''
        f''' Tensors will be created on \'cpu\' and then moved to {device}. Note that one can probably'''
        f''' slighly speed up this function by passing a generator that was created on the {device} device.'''			)
  elif gen_device_type != device.type and gen_device_type == "cuda":
   raise ValueError(f'''Cannot generate a {device} tensor from a generator of type {gen_device_type}.'''			)

 if isinstance(lowercase_	,  lowercase_			):
  SCREAMING_SNAKE_CASE				    =		(1,) + shape[1:]
  SCREAMING_SNAKE_CASE				    =		[
      torch.randn(lowercase_	,  generator=generator[i]	,  device=lowercase_	,  dtype=lowercase_	,  layout=lowercase_			)
      for i in range(lowercase_			)
  ]
  SCREAMING_SNAKE_CASE				    =		torch.cat(lowercase_	,  dim=0			).to(lowercase_			)
 else:
  SCREAMING_SNAKE_CASE				    =		torch.randn(lowercase_	,  generator=lowercase_	,  device=lowercase_	,  dtype=lowercase_	,  layout=lowercase_			).to(lowercase_			)

 return latents





def 						A_					(						lowercase_			)				->Optional[Any]:







 """simple docstring"""

 if is_torch_version('<'	,  '2.0.0'			) or not hasattr(lowercase_	,  '_dynamo'			):
  return False
 return isinstance(lowercase_	,  torch._dynamo.eval_frame.OptimizedModule			)










import warnings

from ...utils import logging
from .image_processing_levit import LevitImageProcessor


snake_case_					:					Dict       						=			logging.get_logger(__name__)







class __snake_case     (     a						):







   def __init__( self						:		Union[str, Any]   ,		*_snake_case						:		int   ,		**_snake_case						:		List[str]):

        """simple docstring"""


        warnings.warn(
            '''The class LevitFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'''
            ''' use LevitImageProcessor instead.'''   ,		_snake_case   ,		)
        super().__init__(*_snake_case   ,		**_snake_case)






