


'''simple docstring'''







import unittest

import numpy as np

from transformers import BlipTextConfig
from transformers.testing_utils import require_torch, slow, torch_device
from transformers.utils import is_torch_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask


if is_torch_available():
   import torch

   from transformers import BlipTextModel
   from transformers.models.blip.modeling_blip import BLIP_PRETRAINED_MODEL_ARCHIVE_LIST







class A__	:






      def __init__(			self      :Optional[Any]					,						SCREAMING_SNAKE_CASE      :Optional[int]					,						SCREAMING_SNAKE_CASE      :Optional[int]=1_2					,						SCREAMING_SNAKE_CASE      :List[Any]=7					,						SCREAMING_SNAKE_CASE      :List[Any]=True					,						SCREAMING_SNAKE_CASE      :Optional[int]=True					,						SCREAMING_SNAKE_CASE      :str=True					,						SCREAMING_SNAKE_CASE      :Optional[int]=9_9					,						SCREAMING_SNAKE_CASE      :Any=3_2					,						SCREAMING_SNAKE_CASE      :str=3_2					,						SCREAMING_SNAKE_CASE      :str=5					,						SCREAMING_SNAKE_CASE      :Tuple=4					,						SCREAMING_SNAKE_CASE      :Optional[int]=3_7					,						SCREAMING_SNAKE_CASE      :Optional[int]=0.1					,						SCREAMING_SNAKE_CASE      :Dict=0.1					,						SCREAMING_SNAKE_CASE      :List[str]=5_1_2					,						SCREAMING_SNAKE_CASE      :Union[str, Any]=0.02					,						SCREAMING_SNAKE_CASE      :int=0					,						SCREAMING_SNAKE_CASE      :str=None					,						)	-> List[str]:




             '''simple docstring'''
             _a   :			str					 =parent
             _a   :			Any					 =batch_size
             _a   :			int					 =seq_length
             _a   :			int					 =is_training
             _a   :			Union[str, Any]					 =use_input_mask
             _a   :			Optional[int]					 =use_labels
             _a   :			str					 =vocab_size
             _a   :			List[Any]					 =hidden_size
             _a   :			int					 =projection_dim
             _a   :			Dict					 =num_hidden_layers
             _a   :			Dict					 =num_attention_heads
             _a   :			Any					 =intermediate_size
             _a   :			Optional[int]					 =dropout
             _a   :			str					 =attention_dropout
             _a   :			Any					 =max_position_embeddings
             _a   :			Optional[Any]					 =initializer_range
             _a   :			Optional[Any]					 =scope
             _a   :			Dict					 =bos_token_id






      def __UpperCAmelCase	(			self      :Dict     )	-> Optional[Any]:




             '''simple docstring'''
             _a   :			List[Any]					 =ids_tensor([self.batch_size, self.seq_length]					,						self.vocab_size     )

             _a   :			Tuple					 =None
             if self.use_input_mask:
                    _a   :			Optional[Any]					 =random_attention_mask([self.batch_size, self.seq_length]     )

             if input_mask is not None:
                    _a ,   _a   :			int					 =input_mask.shape
                    _a   :			List[Any]					 =np.random.randint(1					,						seq_length - 1					,						size=(batch_size,)     )
                    for batch_idx, start_index in enumerate(SCREAMING_SNAKE_CASE     ):
                           _a   :			Tuple					 =1
                           _a   :			int					 =0

             _a   :			int					 =self.get_config()

             return config, input_ids, input_mask






      def __UpperCAmelCase	(			self      :str     )	-> Any:




             '''simple docstring'''
             return BlipTextConfig(
                 vocab_size=self.vocab_size					,						hidden_size=self.hidden_size					,						projection_dim=self.projection_dim					,						num_hidden_layers=self.num_hidden_layers					,						num_attention_heads=self.num_attention_heads					,						intermediate_size=self.intermediate_size					,						dropout=self.dropout					,						attention_dropout=self.attention_dropout					,						max_position_embeddings=self.max_position_embeddings					,						initializer_range=self.initializer_range					,						bos_token_id=self.bos_token_id					,						)






      def __UpperCAmelCase	(			self      :Optional[int]					,						SCREAMING_SNAKE_CASE      :Optional[Any]					,						SCREAMING_SNAKE_CASE      :Optional[int]					,						SCREAMING_SNAKE_CASE      :Tuple     )	-> List[str]:




             '''simple docstring'''
             _a   :			Any					 =BlipTextModel(config=SCREAMING_SNAKE_CASE     )
             model.to(SCREAMING_SNAKE_CASE     )
             model.eval()
             with torch.no_grad():
                    _a   :			Optional[int]					 =model(SCREAMING_SNAKE_CASE					,						attention_mask=SCREAMING_SNAKE_CASE     )
                    _a   :			List[str]					 =model(SCREAMING_SNAKE_CASE     )
             self.parent.assertEqual(result.last_hidden_state.shape					,						(self.batch_size, self.seq_length, self.hidden_size)     )
             self.parent.assertEqual(result.pooler_output.shape					,						(self.batch_size, self.hidden_size)     )






      def __UpperCAmelCase	(			self      :Union[str, Any]     )	-> Optional[int]:




             '''simple docstring'''
             _a   :			Tuple					 =self.prepare_config_and_inputs()
             _a ,   _a ,   _a   :			Dict					 =config_and_inputs
             _a   :			Optional[int]					 ={"""input_ids""": input_ids, """attention_mask""": input_mask}
             return config, inputs_dict







@require_torch
class A__	(						UpperCAmelCase__			,					unittest.TestCase				):
      __UpperCamelCase	:  List[str]     	=							(BlipTextModel,) if is_torch_available() else ()
      __UpperCamelCase	:  Tuple     	=							False
      __UpperCamelCase	:  str     	=							False
      __UpperCamelCase	:  Any     	=							False






      def __UpperCAmelCase	(			self      :List[Any]     )	-> Any:




             '''simple docstring'''
             _a   :			Dict					 =BlipTextModelTester(self     )
             _a   :			Tuple					 =ConfigTester(self					,						config_class=SCREAMING_SNAKE_CASE					,						hidden_size=3_7     )






      def __UpperCAmelCase	(			self      :List[Any]     )	-> str:




             '''simple docstring'''
             self.config_tester.run_common_tests()






      def __UpperCAmelCase	(			self      :Optional[int]     )	-> List[str]:




             '''simple docstring'''
             _a   :			Any					 =self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE     )






      def __UpperCAmelCase	(			self      :Optional[Any]     )	-> Tuple:




             '''simple docstring'''
             pass






      def __UpperCAmelCase	(			self      :Tuple     )	-> List[Any]:




             '''simple docstring'''
             pass






      @unittest.skip(reason="""Blip does not use inputs_embeds"""     )
      def __UpperCAmelCase	(			self      :Union[str, Any]     )	-> Dict:




             '''simple docstring'''
             pass






      @unittest.skip(reason="""BlipTextModel has no base class and is not available in MODEL_MAPPING"""     )
      def __UpperCAmelCase	(			self      :Dict     )	-> Union[str, Any]:




             '''simple docstring'''
             pass






      @unittest.skip(reason="""BlipTextModel has no base class and is not available in MODEL_MAPPING"""     )
      def __UpperCAmelCase	(			self      :List[Any]     )	-> Optional[int]:




             '''simple docstring'''
             pass






      @slow
      def __UpperCAmelCase	(			self      :Optional[Any]     )	-> Tuple:




             '''simple docstring'''
             for model_name in BLIP_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                    _a   :			str					 =BlipTextModel.from_pretrained(SCREAMING_SNAKE_CASE     )
                    self.assertIsNotNone(SCREAMING_SNAKE_CASE     )






      def __UpperCAmelCase	(			self      :Dict     )	-> List[str]:




             '''simple docstring'''
             super().test_pt_tf_model_equivalence(allow_missing_keys=SCREAMING_SNAKE_CASE     )






'''simple docstring'''







def      SCREAMING_SNAKE_CASE_ (  _UpperCAmelCase     :     Union[str, Any]  )  ->      int:
       _a   :			List[str]					 =[701, 301, 132, 57, 23, 10, 4, 1]
       for gap in gaps:
              for i in range(_UpperCAmelCase   ,len(_UpperCAmelCase  )  ):
                     _a   :			Tuple					 =collection[i]
                     _a   :			Optional[Any]					 =i
                     while j >= gap and collection[j - gap] > insert_value:
                            _a   :			Union[str, Any]					 =collection[j - gap]
                            j -= gap
                     if j != i:
                            _a   :			Union[str, Any]					 =insert_value
       return collection


if __name__ == "__main__":
   from doctest import testmod

   testmod()
   A__:   int    =	input('''Enter numbers separated by a comma:\n''').strip()
   A__:   Optional[Any]    =	[int(item) for item in user_input.split(''',''')]
   print(shell_sort(unsorted))


