


"""simple docstring"""
from __future__ import annotations

import sys






def 						lowercase				(	_snake_case		: int	,  _snake_case		: int	)	->tuple[int, int]:
	"""simple docstring"""





	if abs(_snake_case	) == 1:
		return a, 0
	elif abs(_snake_case	) == 1:
		return 0, b

	__snake_case      ,				__snake_case      :		int         =							a, b
	__snake_case      ,				__snake_case      :		str         =							1, 0
	__snake_case      ,				__snake_case      :		Optional[Any]         =							0, 1

	while remainder != 0:
		__snake_case      :		str         =							old_remainder // remainder
		__snake_case      ,				__snake_case      :		Optional[int]         =							remainder, old_remainder - quotient * remainder
		__snake_case      ,				__snake_case      :		Optional[Any]         =							coeff_a, old_coeff_a - quotient * coeff_a
		__snake_case      ,				__snake_case      :		List[str]         =							coeff_b, old_coeff_b - quotient * coeff_b

	# sign correction for negative numbers
	if a < 0:
		__snake_case      :		Tuple         =							-old_coeff_a
	if b < 0:
		__snake_case      :		Dict         =							-old_coeff_b

	return old_coeff_a, old_coeff_b






def 						lowercase				(	)	->str:
	"""simple docstring"""





	if len(sys.argv	) < 3:
		print('''2 integer arguments required'''	)
		return 1
	__snake_case      :		Optional[int]         =							int(sys.argv[1]	)
	__snake_case      :		Any         =							int(sys.argv[2]	)
	print(extended_euclidean_algorithm(_snake_case	,  _snake_case	)	)
	return 0


if __name__ == "__main__":
			raise SystemExit(main())











'''simple docstring'''





from typing import List

from ...processing_utils import ProcessorMixin
from ...utils import is_torch_available


if is_torch_available():
       import torch






class     lowercase  ( UpperCAmelCase_):
      __lowercase					=	['''image_processor''', '''tokenizer''']
      __lowercase					=	'''OneFormerImageProcessor'''
      __lowercase					=	('''CLIPTokenizer''', '''CLIPTokenizerFast''')






      def __init__(self			,	a__=None			,	a__=None			,	a__ = 7_7			,	a__ = 7_7			,	**a__       )							-> str:
         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`.'''       )

         SCREAMING_SNAKE_CASE__      :					Tuple							    =			max_seq_length
         SCREAMING_SNAKE_CASE__      :					Tuple							    =			task_seq_length

         super().__init__(a__			,	a__       )






      def  A__(self			,	a__=None			,	a__=7_7       )							-> str:
         if text_list is None:
            raise ValueError('''tokens cannot be None.'''       )

         SCREAMING_SNAKE_CASE__      :					int							    =			self.tokenizer(a__			,	padding='''max_length'''			,	max_length=a__			,	truncation=a__       )

         SCREAMING_SNAKE_CASE__    ,					SCREAMING_SNAKE_CASE__      :					Any							    =			tokens['''attention_mask'''], tokens['''input_ids''']

         SCREAMING_SNAKE_CASE__      :					Tuple							    =			[]
         for attn_mask, input_id in zip(a__			,	a__       ):
            SCREAMING_SNAKE_CASE__      :					List[str]							    =			torch.tensor(a__       ) * torch.tensor(a__       )
            token_inputs.append(token.unsqueeze(0       )       )

         SCREAMING_SNAKE_CASE__      :					Dict							    =			torch.cat(a__			,	dim=0       )
         return token_inputs






      def __call__(self			,	a__=None			,	a__=None			,	a__=None			,	**a__       )							-> str:

         if task_inputs is None:
            raise ValueError('''You have to specify the task_input. Found None.'''       )
         elif images is None:
            raise ValueError('''You have to specify the image. Found None.'''       )

         if not all(task in ['''semantic''', '''instance''', '''panoptic'''] for task in task_inputs       ):
            raise ValueError('''task_inputs must be semantic, instance, or panoptic.'''       )

         SCREAMING_SNAKE_CASE__      :					Dict							    =			self.image_processor(a__			,	a__			,	a__			,	**a__       )

         if isinstance(a__			,	a__       ):
            SCREAMING_SNAKE_CASE__      :					List[str]							    =			[task_inputs]

         if isinstance(a__			,	a__       ) and all(isinstance(a__			,	a__       ) for task_input in task_inputs       ):
            SCREAMING_SNAKE_CASE__      :					Any							    =			[]
            for task in task_inputs:
               SCREAMING_SNAKE_CASE__      :					Tuple							    =			f"""the task is {task}"""
               task_token_inputs.append(a__       )
            SCREAMING_SNAKE_CASE__      :					int							    =			self._preprocess_text(a__			,	max_length=self.task_seq_length       )
         else:
            raise TypeError('''Task Inputs should be a string or a list of strings.'''       )

         if hasattr(a__			,	'''text_inputs'''       ):
            SCREAMING_SNAKE_CASE__      :					Tuple							    =			encoded_inputs.text_inputs

            SCREAMING_SNAKE_CASE__      :					int							    =			[]
            for texts in texts_list:
               SCREAMING_SNAKE_CASE__      :					Any							    =			self._preprocess_text(a__			,	max_length=self.max_seq_length       )
               text_inputs.append(text_input_list.unsqueeze(0       )       )

            SCREAMING_SNAKE_CASE__      :					List[str]							    =			torch.cat(a__			,	dim=0       )

         return encoded_inputs






      def  A__(self			,	a__=None			,	a__=None			,	a__=None			,	**a__       )							-> Any:

         if task_inputs is None:
            raise ValueError('''You have to specify the task_input. Found None.'''       )
         elif images is None:
            raise ValueError('''You have to specify the image. Found None.'''       )

         if not all(task in ['''semantic''', '''instance''', '''panoptic'''] for task in task_inputs       ):
            raise ValueError('''task_inputs must be semantic, instance, or panoptic.'''       )

         SCREAMING_SNAKE_CASE__      :					List[str]							    =			self.image_processor.encode_inputs(a__			,	a__			,	a__			,	**a__       )

         if isinstance(a__			,	a__       ):
            SCREAMING_SNAKE_CASE__      :					Optional[Any]							    =			[task_inputs]

         if isinstance(a__			,	a__       ) and all(isinstance(a__			,	a__       ) for task_input in task_inputs       ):
            SCREAMING_SNAKE_CASE__      :					List[Any]							    =			[]
            for task in task_inputs:
               SCREAMING_SNAKE_CASE__      :					Union[str, Any]							    =			f"""the task is {task}"""
               task_token_inputs.append(a__       )
            SCREAMING_SNAKE_CASE__      :					Tuple							    =			self._preprocess_text(a__			,	max_length=self.task_seq_length       )
         else:
            raise TypeError('''Task Inputs should be a string or a list of strings.'''       )

         if hasattr(a__			,	'''text_inputs'''       ):
            SCREAMING_SNAKE_CASE__      :					List[Any]							    =			encoded_inputs.text_inputs

            SCREAMING_SNAKE_CASE__      :					List[Any]							    =			[]
            for texts in texts_list:
               SCREAMING_SNAKE_CASE__      :					Any							    =			self._preprocess_text(a__			,	max_length=self.max_seq_length       )
               text_inputs.append(text_input_list.unsqueeze(0       )       )

            SCREAMING_SNAKE_CASE__      :					Union[str, Any]							    =			torch.cat(a__			,	dim=0       )

         return encoded_inputs






      def  A__(self			,	*a__			,	**a__       )							-> str:
         return self.image_processor.post_process_semantic_segmentation(*a__			,	**a__       )






      def  A__(self			,	*a__			,	**a__       )							-> Optional[Any]:
         return self.image_processor.post_process_instance_segmentation(*a__			,	**a__       )






      def  A__(self			,	*a__			,	**a__       )							-> Tuple:
         return self.image_processor.post_process_panoptic_segmentation(*a__			,	**a__       )

