
from __future__ import annotations

import unittest

from transformers import MobileBertConfig, 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,
							    TFMobileBertForMaskedLM,
							    TFMobileBertForMultipleChoice,
							    TFMobileBertForNextSentencePrediction,
							    TFMobileBertForPreTraining,
							    TFMobileBertForQuestionAnswering,
							    TFMobileBertForSequenceClassification,
							    TFMobileBertForTokenClassification,
							    TFMobileBertModel,
							)
@require_tf
class 	A__   (						_A    ,						_A    ,						unittest.TestCase				):
							lowerCAmelCase__		:						int    			=							(
							    (
							        TFMobileBertModel,
							        TFMobileBertForMaskedLM,
							        TFMobileBertForNextSentencePrediction,
							        TFMobileBertForPreTraining,
							        TFMobileBertForQuestionAnswering,
							        TFMobileBertForSequenceClassification,
							        TFMobileBertForTokenClassification,
							        TFMobileBertForMultipleChoice,
							    )
							    if is_tf_available()
							    else ()
							)
							lowerCAmelCase__		:						Any    			=							(
							    {
							        "feature-extraction": TFMobileBertModel,
							        "fill-mask": TFMobileBertForMaskedLM,
							        "question-answering": TFMobileBertForQuestionAnswering,
							        "text-classification": TFMobileBertForSequenceClassification,
							        "token-classification": TFMobileBertForTokenClassification,
							        "zero-shot": TFMobileBertForSequenceClassification,
							    }
							    if is_tf_available()
							    else {}
							)
							lowerCAmelCase__		:						str    			=							False
							lowerCAmelCase__		:						int    			=							False





							def 			a__ ( self  :   Dict     , _UpperCAmelCase  :   Dict     , _UpperCAmelCase  :   List[Any]     , _UpperCAmelCase  :   Tuple=False				)						->		int:



											"""simple docstring"""


											__lowercase								=					super()._prepare_for_class(_UpperCAmelCase     , _UpperCAmelCase     , return_labels=_UpperCAmelCase				)

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

											return inputs_dict
							class 	A__   (						_A				):





														def __init__( self  :   Any     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   int=13     , _UpperCAmelCase  :   Any=7     , _UpperCAmelCase  :   Optional[Any]=True     , _UpperCAmelCase  :   List[str]=True     , _UpperCAmelCase  :   List[Any]=True     , _UpperCAmelCase  :   Dict=True     , _UpperCAmelCase  :   List[str]=99     , _UpperCAmelCase  :   str=32     , _UpperCAmelCase  :   str=32     , _UpperCAmelCase  :   List[Any]=2     , _UpperCAmelCase  :   Tuple=4     , _UpperCAmelCase  :   Optional[Any]=37     , _UpperCAmelCase  :   Tuple="gelu"     , _UpperCAmelCase  :   Optional[int]=0.1     , _UpperCAmelCase  :   Tuple=0.1     , _UpperCAmelCase  :   Optional[int]=5_12     , _UpperCAmelCase  :   List[Any]=16     , _UpperCAmelCase  :   Optional[Any]=2     , _UpperCAmelCase  :   Any=0.02     , _UpperCAmelCase  :   List[str]=3     , _UpperCAmelCase  :   Dict=4     , _UpperCAmelCase  :   Tuple=None     , )						->		List[Any]:



																		"""simple docstring"""


																		__lowercase								=					parent
																		__lowercase								=					batch_size
																		__lowercase								=					seq_length
																		__lowercase								=					is_training
																		__lowercase								=					use_input_mask
																		__lowercase								=					use_token_type_ids
																		__lowercase								=					use_labels
																		__lowercase								=					vocab_size
																		__lowercase								=					hidden_size
																		__lowercase								=					num_hidden_layers
																		__lowercase								=					num_attention_heads
																		__lowercase								=					intermediate_size
																		__lowercase								=					hidden_act
																		__lowercase								=					hidden_dropout_prob
																		__lowercase								=					attention_probs_dropout_prob
																		__lowercase								=					max_position_embeddings
																		__lowercase								=					type_vocab_size
																		__lowercase								=					type_sequence_label_size
																		__lowercase								=					initializer_range
																		__lowercase								=					num_labels
																		__lowercase								=					num_choices
																		__lowercase								=					scope
																		__lowercase								=					embedding_size





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



																		"""simple docstring"""


																		__lowercase								=					ids_tensor([self.batch_size, self.seq_length]     , self.vocab_size				)

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

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

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

																		__lowercase								=					MobileBertConfig(
																		    vocab_size=self.vocab_size     , hidden_size=self.hidden_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     , embedding_size=self.embedding_size     , )

																		return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels





														def 			a__ ( self  :   List[str]     , _UpperCAmelCase  :   List[str]     , _UpperCAmelCase  :   Optional[int]     , _UpperCAmelCase  :   str     , _UpperCAmelCase  :   Union[str, Any]     , _UpperCAmelCase  :   List[str]     , _UpperCAmelCase  :   Optional[Any]     , _UpperCAmelCase  :   Union[str, Any]				)						->		Optional[Any]:



																		"""simple docstring"""


																		__lowercase								=					TFMobileBertModel(config=_UpperCAmelCase				)
																		__lowercase								=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
																		__lowercase								=					model(_UpperCAmelCase				)

																		__lowercase								=					[input_ids, input_mask]
																		__lowercase								=					model(_UpperCAmelCase				)

																		__lowercase								=					model(_UpperCAmelCase				)

																		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  :   List[Any]     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   Optional[int]     , _UpperCAmelCase  :   List[str]     , _UpperCAmelCase  :   Dict				)						->		List[Any]:



																		"""simple docstring"""


																		__lowercase								=					TFMobileBertForMaskedLM(config=_UpperCAmelCase				)
																		__lowercase								=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
																		__lowercase								=					model(_UpperCAmelCase				)
																		self.parent.assertEqual(result.logits.shape     , (self.batch_size, self.seq_length, self.vocab_size)				)





														def 			a__ ( self  :   List[Any]     , _UpperCAmelCase  :   Optional[Any]     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   Dict     , _UpperCAmelCase  :   Union[str, Any]     , _UpperCAmelCase  :   List[Any]     , _UpperCAmelCase  :   List[str]     , _UpperCAmelCase  :   List[Any]				)						->		Union[str, Any]:



																		"""simple docstring"""


																		__lowercase								=					TFMobileBertForNextSentencePrediction(config=_UpperCAmelCase				)
																		__lowercase								=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
																		__lowercase								=					model(_UpperCAmelCase				)
																		self.parent.assertEqual(result.logits.shape     , (self.batch_size, 2)				)





														def 			a__ ( self  :   Any     , _UpperCAmelCase  :   List[str]     , _UpperCAmelCase  :   Union[str, Any]     , _UpperCAmelCase  :   Any     , _UpperCAmelCase  :   Any     , _UpperCAmelCase  :   Tuple     , _UpperCAmelCase  :   Optional[Any]     , _UpperCAmelCase  :   str				)						->		List[str]:



																		"""simple docstring"""


																		__lowercase								=					TFMobileBertForPreTraining(config=_UpperCAmelCase				)
																		__lowercase								=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
																		__lowercase								=					model(_UpperCAmelCase				)
																		self.parent.assertEqual(
																		    result.prediction_logits.shape     , (self.batch_size, self.seq_length, self.vocab_size)				)
																		self.parent.assertEqual(result.seq_relationship_logits.shape     , (self.batch_size, 2)				)





														def 			a__ ( self  :   Dict     , _UpperCAmelCase  :   Optional[int]     , _UpperCAmelCase  :   List[Any]     , _UpperCAmelCase  :   List[Any]     , _UpperCAmelCase  :   Union[str, Any]     , _UpperCAmelCase  :   Optional[Any]     , _UpperCAmelCase  :   Any     , _UpperCAmelCase  :   str				)						->		str:



																		"""simple docstring"""


																		__lowercase								=					self.num_labels
																		__lowercase								=					TFMobileBertForSequenceClassification(config=_UpperCAmelCase				)
																		__lowercase								=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
																		__lowercase								=					model(_UpperCAmelCase				)
																		self.parent.assertEqual(result.logits.shape     , (self.batch_size, self.num_labels)				)





														def 			a__ ( self  :   List[str]     , _UpperCAmelCase  :   Optional[int]     , _UpperCAmelCase  :   Union[str, Any]     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   Optional[int]     , _UpperCAmelCase  :   List[Any]     , _UpperCAmelCase  :   Any     , _UpperCAmelCase  :   Tuple				)						->		str:



																		"""simple docstring"""


																		__lowercase								=					self.num_choices
																		__lowercase								=					TFMobileBertForMultipleChoice(config=_UpperCAmelCase				)
																		__lowercase								=					tf.tile(tf.expand_dims(_UpperCAmelCase     , 1				)     , (1, self.num_choices, 1)				)
																		__lowercase								=					tf.tile(tf.expand_dims(_UpperCAmelCase     , 1				)     , (1, self.num_choices, 1)				)
																		__lowercase								=					tf.tile(tf.expand_dims(_UpperCAmelCase     , 1				)     , (1, self.num_choices, 1)				)
																		__lowercase								=					{
																		    '''input_ids''': multiple_choice_inputs_ids,
																		    '''attention_mask''': multiple_choice_input_mask,
																		    '''token_type_ids''': multiple_choice_token_type_ids,
																		}
																		__lowercase								=					model(_UpperCAmelCase				)
																		self.parent.assertEqual(result.logits.shape     , (self.batch_size, self.num_choices)				)





														def 			a__ ( self  :   Tuple     , _UpperCAmelCase  :   Optional[int]     , _UpperCAmelCase  :   Optional[Any]     , _UpperCAmelCase  :   Any     , _UpperCAmelCase  :   Dict     , _UpperCAmelCase  :   Optional[int]     , _UpperCAmelCase  :   Dict     , _UpperCAmelCase  :   str				)						->		str:



																		"""simple docstring"""


																		__lowercase								=					self.num_labels
																		__lowercase								=					TFMobileBertForTokenClassification(config=_UpperCAmelCase				)
																		__lowercase								=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
																		__lowercase								=					model(_UpperCAmelCase				)
																		self.parent.assertEqual(result.logits.shape     , (self.batch_size, self.seq_length, self.num_labels)				)





														def 			a__ ( self  :   Dict     , _UpperCAmelCase  :   Dict     , _UpperCAmelCase  :   Optional[Any]     , _UpperCAmelCase  :   List[Any]     , _UpperCAmelCase  :   Union[str, Any]     , _UpperCAmelCase  :   List[str]     , _UpperCAmelCase  :   int     , _UpperCAmelCase  :   str				)						->		Optional[Any]:



																		"""simple docstring"""


																		__lowercase								=					TFMobileBertForQuestionAnswering(config=_UpperCAmelCase				)
																		__lowercase								=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
																		__lowercase								=					model(_UpperCAmelCase				)
																		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  :   int				)						->		Union[str, Any]:



																		"""simple docstring"""


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






							def 			a__ ( self  :   Tuple				)						->		Tuple:



											"""simple docstring"""


											__lowercase								=					TFMobileBertModelTest.TFMobileBertModelTester(self				)
											__lowercase								=					ConfigTester(self     , config_class=_UpperCAmelCase     , hidden_size=37				)





							def 			a__ ( self  :   int				)						->		Optional[Any]:



											"""simple docstring"""


											self.config_tester.run_common_tests()





							def 			a__ ( self  :   List[str]				)						->		Tuple:



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_model(*_UpperCAmelCase				)





							def 			a__ ( self  :   List[Any]				)						->		Union[str, Any]:



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_for_masked_lm(*_UpperCAmelCase				)





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



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_for_multiple_choice(*_UpperCAmelCase				)





							def 			a__ ( self  :   str				)						->		Any:



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_for_next_sequence_prediction(*_UpperCAmelCase				)





							def 			a__ ( self  :   Optional[int]				)						->		int:



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_for_pretraining(*_UpperCAmelCase				)





							def 			a__ ( self  :   str				)						->		int:



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_for_question_answering(*_UpperCAmelCase				)





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



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_for_sequence_classification(*_UpperCAmelCase				)





							def 			a__ ( self  :   str				)						->		Any:



											"""simple docstring"""


											__lowercase								=					self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_mobilebert_for_token_classification(*_UpperCAmelCase				)





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



											"""simple docstring"""


											for model_name in ["google/mobilebert-uncased"]:
															__lowercase								=					TFMobileBertModel.from_pretrained(_UpperCAmelCase				)
															self.assertIsNotNone(_UpperCAmelCase				)






@require_tf
class 	A__   (						unittest.TestCase				):





							@slow
							def 			a__ ( self  :   Union[str, Any]				)						->		List[Any]:



											"""simple docstring"""


											__lowercase								=					TFMobileBertForPreTraining.from_pretrained('google/mobilebert-uncased'				)
											__lowercase								=					tf.constant([[0, 1, 2, 3, 4, 5]]				)
											__lowercase								=					model(_UpperCAmelCase				)[0]

											__lowercase								=					[1, 6, 3_05_22]
											self.assertEqual(output.shape     , _UpperCAmelCase				)

											__lowercase								=					tf.constant(
											    [
											        [
											            [-4.5_919_547, -9.248_295, -9.645_256],
											            [-6.7_306_175, -6.440_284, -6.6_052_837],
											            [-7.2_743_506, -6.7_847_915, -6.024_673],
											        ]
											    ]				)
											tf.debugging.assert_near(output[:, :3, :3]     , _UpperCAmelCase     , atol=1e-4				)













"""simple docstring"""



def 						lowercase    (				__snake_case				: list[int]	):
		lowercase_ : List[Any]							       =   len(__snake_case	)
		for i in range(__snake_case	):
				for j in range(i + 1		,					__snake_case	):
						if numbers[j] < numbers[i]:
								lowercase_       ,					lowercase_ : Optional[int]							       =   numbers[j], numbers[i]
		return numbers


if __name__ == "__main__":
						__A		:       int  				=		input('''Enter numbers separated by a comma:\n''').strip()
						__A		:       Any  				=		[int(item) for item in user_input.split(''',''')]
						print(exchange_sort(unsorted))



