

import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding







class        a__       (   UpperCAmelCase       ):







  """simple docstring"""




  UpperCAmelCase__      : Any			       =["""image_processor""", """tokenizer"""]
  UpperCAmelCase__      : Optional[int]			       ="""CLIPImageProcessor"""
  UpperCAmelCase__      : str			       =("""CLIPTokenizer""", """CLIPTokenizerFast""")


  def __init__(			self    : Any				,				UpperCAmelCase__    : Optional[Any]=None				,				UpperCAmelCase__    : Optional[int]=None				,				**UpperCAmelCase__    : Optional[int]		)					->List[Any]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE :      Union[str, Any]       =   None
        if "feature_extractor" in kwargs:
              warnings.warn(
                  """The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"""
                  """ instead."""				,				UpperCAmelCase__				,				)
              SCREAMING_SNAKE_CASE :      Optional[Any]       =   kwargs.pop("""feature_extractor"""		)

        SCREAMING_SNAKE_CASE :      Dict       =   image_processor if image_processor is not None else feature_extractor
        if image_processor is None:
              raise ValueError("""You need to specify an `image_processor`."""		)
        if tokenizer is None:
              raise ValueError("""You need to specify a `tokenizer`."""		)

        super().__init__(UpperCAmelCase__				,				UpperCAmelCase__		)


  def __call__(			self    : Optional[int]				,				UpperCAmelCase__    : int=None				,				UpperCAmelCase__    : Tuple=None				,				UpperCAmelCase__    : List[str]=None				,				**UpperCAmelCase__    : Optional[int]		)					->Optional[int]:
        """simple docstring"""







        if text is None and images is None:
              raise ValueError("""You have to specify either text or images. Both cannot be none."""		)

        if text is not None:
              SCREAMING_SNAKE_CASE :      int       =   self.tokenizer(UpperCAmelCase__				,				return_tensors=UpperCAmelCase__				,				**UpperCAmelCase__		)

        if images is not None:
              SCREAMING_SNAKE_CASE :      int       =   self.image_processor(UpperCAmelCase__				,				return_tensors=UpperCAmelCase__				,				**UpperCAmelCase__		)

        if text is not None and images is not None:
              SCREAMING_SNAKE_CASE :      List[str]       =   image_features.pixel_values
              return encoding
        elif text is not None:
              return encoding
        else:
              return BatchEncoding(data=dict(**UpperCAmelCase__		)				,				tensor_type=UpperCAmelCase__		)


  def  _lowercase      (			self    : Optional[int]				,				*UpperCAmelCase__    : List[str]				,				**UpperCAmelCase__    : Any		)					->Optional[Any]:
        """simple docstring"""







        return self.tokenizer.batch_decode(*UpperCAmelCase__				,				**UpperCAmelCase__		)


  def  _lowercase      (			self    : int				,				*UpperCAmelCase__    : List[Any]				,				**UpperCAmelCase__    : Optional[Any]		)					->Union[str, Any]:
        """simple docstring"""







        return self.tokenizer.decode(*UpperCAmelCase__				,				**UpperCAmelCase__		)


  @property
  def  _lowercase      (			self    : List[Any]		)					->Dict:
        """simple docstring"""







        SCREAMING_SNAKE_CASE :      List[Any]       =   self.tokenizer.model_input_names
        SCREAMING_SNAKE_CASE :      List[str]       =   self.image_processor.model_input_names
        return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names		)		)


  @property
  def  _lowercase      (			self    : int		)					->Dict:
        """simple docstring"""







        warnings.warn(
            """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""				,				UpperCAmelCase__				,				)
        return self.image_processor_class




  @property
  def  _lowercase      (			self    : List[Any]		)					->str:
        """simple docstring"""







        warnings.warn(
            """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""				,				UpperCAmelCase__				,				)
        return self.image_processor







from typing import Any

import numpy as np






def 					__lowercase      (     _A			)     ->						bool:
      return np.array_equal(_A						,    matrix.conjugate().T			)






def 					__lowercase      (     _A						,    _A			)     ->						Any:
      SCREAMING_SNAKE_CASE :      Optional[int]       =   v.conjugate().T
      SCREAMING_SNAKE_CASE :      List[Any]       =   v_star.dot(_A			)
      assert isinstance(_A						,    np.ndarray			)
      return (v_star_dot.dot(_A			)) / (v_star.dot(_A			))






def 					__lowercase      (     )     ->						None:
      SCREAMING_SNAKE_CASE :      Any       =   np.array([[2, 2 + 1J, 4], [2 - 1J, 3, 1J], [4, -1J, 1]]			)
      SCREAMING_SNAKE_CASE :      Optional[int]       =   np.array([[1], [2], [3]]			)
      assert is_hermitian(_A			), F"{a} is not hermitian."
      print(rayleigh_quotient(_A						,    _A			)			)

      SCREAMING_SNAKE_CASE :      Any       =   np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]			)
      assert is_hermitian(_A			), F"{a} is not hermitian."
      assert rayleigh_quotient(_A						,    _A			) == float(3			)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  tests()




