






from __future__ import annotations

import unittest

from transformers import AlbertConfig, is_tf_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
					import tensorflow as tf

					from transformers import TF_MODEL_FOR_PRETRAINING_MAPPING
					from transformers.models.albert.modeling_tf_albert import (
					    TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
					    TFAlbertForMaskedLM,
					    TFAlbertForMultipleChoice,
					    TFAlbertForPreTraining,
					    TFAlbertForQuestionAnswering,
					    TFAlbertForSequenceClassification,
					    TFAlbertForTokenClassification,
					    TFAlbertModel,
					)
class   UpperCamelCase			:







		"""simple docstring"""



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


						'''simple docstring'''
						A									=   parent
						A									=   1_3
						A									=   7
						A									=   True
						A									=   True
						A									=   True
						A									=   True
						A									=   9_9
						A									=   1_6
						A									=   3_2
						A									=   2
						A									=   4
						A									=   3_7
						A									=   'gelu'
						A									=   0.1
						A									=   0.1
						A									=   5_1_2
						A									=   1_6
						A									=   2
						A									=   0.02
						A									=   3
						A									=   4
						A									=   None
		def    A(	self		:							Tuple		)     -> Tuple:


						'''simple docstring'''
						A									=   ids_tensor([self.batch_size, self.seq_length]    ,self.vocab_size		)

						A									=   None
						if self.use_input_mask:
										A									=   random_attention_mask([self.batch_size, self.seq_length]		)

						A									=   None
						if self.use_token_type_ids:
										A									=   ids_tensor([self.batch_size, self.seq_length]    ,self.type_vocab_size		)

						A									=   None
						A									=   None
						A									=   None
						if self.use_labels:
										A									=   ids_tensor([self.batch_size]    ,self.type_sequence_label_size		)
										A									=   ids_tensor([self.batch_size, self.seq_length]    ,self.num_labels		)
										A									=   ids_tensor([self.batch_size]    ,self.num_choices		)

						A									=   AlbertConfig(
						    vocab_size=self.vocab_size    ,hidden_size=self.hidden_size    ,embedding_size=self.embedding_size    ,num_hidden_layers=self.num_hidden_layers    ,num_attention_heads=self.num_attention_heads    ,intermediate_size=self.intermediate_size    ,hidden_act=self.hidden_act    ,hidden_dropout_prob=self.hidden_dropout_prob    ,attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,max_position_embeddings=self.max_position_embeddings    ,type_vocab_size=self.type_vocab_size    ,initializer_range=self.initializer_range    ,)

						return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels
		def    A(	self		:							Tuple    ,_SCREAMING_SNAKE_CASE		:							Any    ,_SCREAMING_SNAKE_CASE		:							Tuple    ,_SCREAMING_SNAKE_CASE		:							Optional[int]    ,_SCREAMING_SNAKE_CASE		:							Dict    ,_SCREAMING_SNAKE_CASE		:							int    ,_SCREAMING_SNAKE_CASE		:							str    ,_SCREAMING_SNAKE_CASE		:							Optional[int]		)     -> List[Any]:


						'''simple docstring'''
						A									=   TFAlbertModel(config=a__		)
						# inputs = {'input_ids': input_ids,
						#           'attention_mask': input_mask,
						#           'token_type_ids': token_type_ids}
						# sequence_output, pooled_output = model(**inputs)
						A									=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
						A									=   model(a__		)

						A									=   [input_ids, input_mask]
						A									=   model(a__		)

						A									=   model(a__		)

						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    A(	self		:							Any    ,_SCREAMING_SNAKE_CASE		:							Dict    ,_SCREAMING_SNAKE_CASE		:							Tuple    ,_SCREAMING_SNAKE_CASE		:							List[str]    ,_SCREAMING_SNAKE_CASE		:							Optional[Any]    ,_SCREAMING_SNAKE_CASE		:							Union[str, Any]    ,_SCREAMING_SNAKE_CASE		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							Union[str, Any]		)     -> str:


						'''simple docstring'''
						A									=   self.num_labels
						A									=   TFAlbertForPreTraining(config=a__		)
						A									=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
						A									=   model(a__		)
						self.parent.assertEqual(result.prediction_logits.shape    ,(self.batch_size, self.seq_length, self.vocab_size)		)
						self.parent.assertEqual(result.sop_logits.shape    ,(self.batch_size, self.num_labels)		)
		def    A(	self		:							Optional[int]    ,_SCREAMING_SNAKE_CASE		:							Dict    ,_SCREAMING_SNAKE_CASE		:							Union[str, Any]    ,_SCREAMING_SNAKE_CASE		:							Tuple    ,_SCREAMING_SNAKE_CASE		:							Any    ,_SCREAMING_SNAKE_CASE		:							Dict    ,_SCREAMING_SNAKE_CASE		:							str    ,_SCREAMING_SNAKE_CASE		:							List[Any]		)     -> Union[str, Any]:


						'''simple docstring'''
						A									=   TFAlbertForMaskedLM(config=a__		)
						A									=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
						A									=   model(a__		)
						self.parent.assertEqual(result.logits.shape    ,(self.batch_size, self.seq_length, self.vocab_size)		)
		def    A(	self		:							int    ,_SCREAMING_SNAKE_CASE		:							Dict    ,_SCREAMING_SNAKE_CASE		:							int    ,_SCREAMING_SNAKE_CASE		:							Union[str, Any]    ,_SCREAMING_SNAKE_CASE		:							Tuple    ,_SCREAMING_SNAKE_CASE		:							List[str]    ,_SCREAMING_SNAKE_CASE		:							str    ,_SCREAMING_SNAKE_CASE		:							List[Any]		)     -> List[str]:


						'''simple docstring'''
						A									=   self.num_labels
						A									=   TFAlbertForSequenceClassification(config=a__		)
						A									=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
						A									=   model(a__		)
						self.parent.assertEqual(result.logits.shape    ,(self.batch_size, self.num_labels)		)
		def    A(	self		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							int    ,_SCREAMING_SNAKE_CASE		:							List[str]    ,_SCREAMING_SNAKE_CASE		:							Dict    ,_SCREAMING_SNAKE_CASE		:							Optional[int]    ,_SCREAMING_SNAKE_CASE		:							str    ,_SCREAMING_SNAKE_CASE		:							Union[str, Any]		)     -> List[str]:


						'''simple docstring'''
						A									=   TFAlbertForQuestionAnswering(config=a__		)
						A									=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
						A									=   model(a__		)
						self.parent.assertEqual(result.start_logits.shape    ,(self.batch_size, self.seq_length)		)
						self.parent.assertEqual(result.end_logits.shape    ,(self.batch_size, self.seq_length)		)
		def    A(	self		:							Any    ,_SCREAMING_SNAKE_CASE		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							str    ,_SCREAMING_SNAKE_CASE		:							str    ,_SCREAMING_SNAKE_CASE		:							Optional[Any]    ,_SCREAMING_SNAKE_CASE		:							Tuple    ,_SCREAMING_SNAKE_CASE		:							Union[str, Any]    ,_SCREAMING_SNAKE_CASE		:							List[str]		)     -> Tuple:


						'''simple docstring'''
						A									=   self.num_choices
						A									=   TFAlbertForMultipleChoice(config=a__		)
						A									=   tf.tile(tf.expand_dims(a__    ,1		)    ,(1, self.num_choices, 1)		)
						A									=   tf.tile(tf.expand_dims(a__    ,1		)    ,(1, self.num_choices, 1)		)
						A									=   tf.tile(tf.expand_dims(a__    ,1		)    ,(1, self.num_choices, 1)		)
						A									=   {
						    'input_ids': multiple_choice_inputs_ids,
						    'attention_mask': multiple_choice_input_mask,
						    'token_type_ids': multiple_choice_token_type_ids,
						}
						A									=   model(a__		)
						self.parent.assertListEqual(list(result['logits'].shape		)    ,[self.batch_size, self.num_choices]		)
		def    A(	self		:							Tuple    ,_SCREAMING_SNAKE_CASE		:							int    ,_SCREAMING_SNAKE_CASE		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							List[str]    ,_SCREAMING_SNAKE_CASE		:							Dict    ,_SCREAMING_SNAKE_CASE		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							List[Any]    ,_SCREAMING_SNAKE_CASE		:							str		)     -> List[Any]:


						'''simple docstring'''
						A									=   self.num_labels
						A									=   TFAlbertForTokenClassification(config=a__		)
						A									=   {
						    'input_ids': input_ids,
						    'attention_mask': input_mask,
						    'token_type_ids': token_type_ids,
						}
						A									=   model(a__		)
						self.parent.assertListEqual(list(result['logits'].shape		)    ,[self.batch_size, self.seq_length, self.num_labels]		)







		def    A(	self		:							Any		)     -> Dict:


						'''simple docstring'''
						A									=   self.prepare_config_and_inputs()
						(
						    (
						    A				
						)			,		(
						    A				
						)			,		(
						    A				
						)			,		(
						    A				
						)			,		(
						    A				
						)			,		(
						    A				
						)			,		(
						    A				
						)			,						
						)									=   config_and_inputs
						A									=   {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
						return config, inputs_dict


@require_tf
class   UpperCamelCase			(					snake_case__      ,							snake_case__      ,							unittest.TestCase			):







		"""simple docstring"""



		snake_case			 = (
		    (
		        TFAlbertModel,
		        TFAlbertForPreTraining,
		        TFAlbertForMaskedLM,
		        TFAlbertForSequenceClassification,
		        TFAlbertForQuestionAnswering,
		        TFAlbertForTokenClassification,
		        TFAlbertForMultipleChoice,
		    )
		    if is_tf_available()
		    else ()
		)
		snake_case			 = (
		    {
		        "feature-extraction": TFAlbertModel,
		        "fill-mask": TFAlbertForMaskedLM,
		        "question-answering": TFAlbertForQuestionAnswering,
		        "text-classification": TFAlbertForSequenceClassification,
		        "token-classification": TFAlbertForTokenClassification,
		        "zero-shot": TFAlbertForSequenceClassification,
		    }
		    if is_tf_available()
		    else {}
		)
		snake_case			 = False
		snake_case			 = False
		def    A(	self		:							int    ,_SCREAMING_SNAKE_CASE		:							int    ,_SCREAMING_SNAKE_CASE		:							Union[str, Any]    ,_SCREAMING_SNAKE_CASE		:							Any=False		)     -> int:


						'''simple docstring'''
						A									=   super()._prepare_for_class(a__    ,a__    ,return_labels=a__		)

						if return_labels:
										if model_class in get_values(a__		):
														A									=   tf.zeros(self.model_tester.batch_size    ,dtype=tf.intaa		)

						return inputs_dict
		def    A(	self		:							str		)     -> List[str]:


						'''simple docstring'''
						A									=   TFAlbertModelTester(self		)
						A									=   ConfigTester(self    ,config_class=a__    ,hidden_size=3_7		)
		def    A(	self		:							Optional[Any]		)     -> Union[str, Any]:


						'''simple docstring'''
						self.config_tester.run_common_tests()
		def    A(	self		:							int		)     -> Any:


						'''simple docstring'''
						A									=   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_albert_model(*a__		)
		def    A(	self		:							Optional[int]		)     -> str:


						'''simple docstring'''
						A									=   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_albert_for_pretraining(*a__		)
		def    A(	self		:							int		)     -> Any:


						'''simple docstring'''
						A									=   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_albert_for_masked_lm(*a__		)
		def    A(	self		:							Union[str, Any]		)     -> Dict:


						'''simple docstring'''
						A									=   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_albert_for_multiple_choice(*a__		)
		def    A(	self		:							Optional[int]		)     -> Any:


						'''simple docstring'''
						A									=   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_albert_for_sequence_classification(*a__		)
		def    A(	self		:							List[str]		)     -> Optional[int]:


						'''simple docstring'''
						A									=   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_albert_for_question_answering(*a__		)







		@slow
		def    A(	self		:							Optional[int]		)     -> Tuple:


						'''simple docstring'''
						for model_name in TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										A									=   TFAlbertModel.from_pretrained(a__		)
										self.assertIsNotNone(a__		)


@require_tf
class   UpperCamelCase			(					unittest.TestCase			):







		"""simple docstring"""



		@slow
		def    A(	self		:							Any		)     -> str:


						'''simple docstring'''
						A									=   TFAlbertForPreTraining.from_pretrained('albert-base-v2'		)
						A									=   tf.constant([[0, 1, 2, 3, 4, 5]]		)
						A									=   model(a__		)[0]

						A									=   [1, 6, 3_0_0_0_0]
						self.assertEqual(output.shape    ,a__		)

						A									=   tf.constant(
						    [
						        [
						            [4.595668, 0.74462754, -1.818147],
						            [4.5954347, 0.7454184, -1.8188258],
						            [4.5954905, 0.7448235, -1.8182316],
						        ]
						    ]		)
						tf.debugging.assert_near(output[:, :3, :3]    ,a__    ,atol=1E-4		)












"""simple docstring"""






def    __lowerCamelCase     (							SCREAMING_SNAKE_CASE				)		->							Dict:






       """simple docstring"""




       _UpperCAmelCase			     =  [701, 301, 132, 57, 23, 10, 4, 1]
       for gap in gaps:
              for i in range(SCREAMING_SNAKE_CASE,len(SCREAMING_SNAKE_CASE				)				):
                     _UpperCAmelCase			     =  collection[i]
                     _UpperCAmelCase			     =  i
                     while j >= gap and collection[j - gap] > insert_value:
                            _UpperCAmelCase			     =  collection[j - gap]
                            j -= gap
                     if j != i:
                            _UpperCAmelCase			     =  insert_value
       return collection


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

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






