






'''simple docstring'''
import unittest

from transformers import MPNetConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

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


if is_torch_available():
 import torch

 from transformers import (
     MPNetForMaskedLM,
     MPNetForMultipleChoice,
     MPNetForQuestionAnswering,
     MPNetForSequenceClassification,
     MPNetForTokenClassification,
     MPNetModel,
 )


class        _UpperCAmelCase						:




    def __init__(			self  :       Optional[Any]  ,     a  :       str  ,     a  :       Tuple=1_3  ,     a  :       Optional[Any]=7  ,     a  :       int=True  ,     a  :       Tuple=True  ,     a  :       List[str]=False  ,     a  :       str=True  ,     a  :       Optional[Any]=9_9  ,     a  :       str=6_4  ,     a  :       str=5  ,     a  :       Union[str, Any]=4  ,     a  :       Dict=6_4  ,     a  :       Union[str, Any]="gelu"  ,     a  :       Dict=0.1  ,     a  :       List[str]=0.1  ,     a  :       List[str]=5_1_2  ,     a  :       int=1_6  ,     a  :       Tuple=2  ,     a  :       Optional[Any]=0.02  ,     a  :       List[str]=3  ,     a  :       Union[str, Any]=4  ,     a  :       List[str]=None  ,     ):






       '''simple docstring'''






       lowercase_	:    Dict           =     parent
       lowercase_	:    Dict           =     batch_size
       lowercase_	:    int           =     seq_length
       lowercase_	:    Tuple           =     is_training
       lowercase_	:    Dict           =     use_input_mask
       lowercase_	:    List[str]           =     use_token_type_ids
       lowercase_	:    str           =     use_labels
       lowercase_	:    Optional[int]           =     vocab_size
       lowercase_	:    List[Any]           =     hidden_size
       lowercase_	:    Union[str, Any]           =     num_hidden_layers
       lowercase_	:    Optional[Any]           =     num_attention_heads
       lowercase_	:    Optional[Any]           =     intermediate_size
       lowercase_	:    Tuple           =     hidden_act
       lowercase_	:    Dict           =     hidden_dropout_prob
       lowercase_	:    Optional[Any]           =     attention_probs_dropout_prob
       lowercase_	:    List[str]           =     max_position_embeddings
       lowercase_	:    Tuple           =     type_vocab_size
       lowercase_	:    List[str]           =     type_sequence_label_size
       lowercase_	:    Optional[Any]           =     initializer_range
       lowercase_	:    Optional[int]           =     num_labels
       lowercase_	:    str           =     num_choices
       lowercase_	:    List[Any]           =     scope




    def 				lowerCAmelCase__				(			self  :       Any			):






       '''simple docstring'''






       return MPNetConfig.from_pretrained("microsoft/mpnet-base"			)




    def 				lowerCAmelCase__				(			self  :       Any			):






       '''simple docstring'''






       lowercase_	:    Dict           =     ids_tensor([self.batch_size, self.seq_length]  ,     self.vocab_size			)

       lowercase_	:    Optional[int]           =     None
       if self.use_input_mask:
          lowercase_	:    int           =     random_attention_mask([self.batch_size, self.seq_length]			)

       lowercase_	:    Dict           =     None
       lowercase_	:    Dict           =     None
       lowercase_	:    List[Any]           =     None
       if self.use_labels:
          lowercase_	:    List[Any]           =     ids_tensor([self.batch_size]  ,     self.type_sequence_label_size			)
          lowercase_	:    Any           =     ids_tensor([self.batch_size, self.seq_length]  ,     self.num_labels			)
          lowercase_	:    Any           =     ids_tensor([self.batch_size]  ,     self.num_choices			)

       lowercase_	:    Optional[int]           =     self.get_config()
       return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels




    def 				lowerCAmelCase__				(			self  :       Optional[Any]			):






       '''simple docstring'''






       return MPNetConfig(
           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  ,     initializer_range=self.initializer_range  ,     )




    def 				lowerCAmelCase__				(			self  :       Tuple  ,     a  :       Union[str, Any]  ,     a  :       Any  ,     a  :       Any  ,     a  :       List[str]  ,     a  :       Tuple  ,     a  :       Any			):






       '''simple docstring'''






       lowercase_	:    Optional[Any]           =     MPNetModel(config=a			)
       model.to(a			)
       model.eval()
       lowercase_	:    Optional[int]           =     model(a  ,     a			)
       lowercase_	:    Dict           =     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 				lowerCAmelCase__				(			self  :       Optional[int]  ,     a  :       Optional[Any]  ,     a  :       int  ,     a  :       Any  ,     a  :       Tuple  ,     a  :       Optional[Any]  ,     a  :       List[Any]			):






       '''simple docstring'''






       lowercase_	:    str           =     MPNetForQuestionAnswering(config=a			)
       model.to(a			)
       model.eval()
       lowercase_	:    Optional[Any]           =     model(
           a  ,     attention_mask=a  ,     start_positions=a  ,     end_positions=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 				lowerCAmelCase__				(			self  :       List[str]  ,     a  :       List[Any]  ,     a  :       Optional[int]  ,     a  :       List[Any]  ,     a  :       Dict  ,     a  :       Dict  ,     a  :       Optional[int]			):






       '''simple docstring'''






       lowercase_	:    Any           =     self.num_labels
       lowercase_	:    List[Any]           =     MPNetForSequenceClassification(a			)
       model.to(a			)
       model.eval()
       lowercase_	:    int           =     model(a  ,     attention_mask=a  ,     labels=a			)
       self.parent.assertEqual(result.logits.shape  ,     (self.batch_size, self.num_labels)			)




    def 				lowerCAmelCase__				(			self  :       Tuple  ,     a  :       Dict  ,     a  :       Tuple  ,     a  :       Optional[Any]  ,     a  :       int  ,     a  :       List[Any]  ,     a  :       Tuple			):






       '''simple docstring'''






       lowercase_	:    List[str]           =     self.num_choices
       lowercase_	:    Any           =     MPNetForMultipleChoice(config=a			)
       model.to(a			)
       model.eval()
       lowercase_	:    List[str]           =     input_ids.unsqueeze(1			).expand(-1  ,     self.num_choices  ,     -1			).contiguous()
       lowercase_	:    Union[str, Any]           =     input_mask.unsqueeze(1			).expand(-1  ,     self.num_choices  ,     -1			).contiguous()
       lowercase_	:    List[Any]           =     model(
           a  ,     attention_mask=a  ,     labels=a  ,     )
       self.parent.assertEqual(result.logits.shape  ,     (self.batch_size, self.num_choices)			)




    def 				lowerCAmelCase__				(			self  :       Union[str, Any]  ,     a  :       List[Any]  ,     a  :       Optional[Any]  ,     a  :       str  ,     a  :       List[Any]  ,     a  :       Any  ,     a  :       Any			):






       '''simple docstring'''






       lowercase_	:    Tuple           =     self.num_labels
       lowercase_	:    int           =     MPNetForTokenClassification(config=a			)
       model.to(a			)
       model.eval()
       lowercase_	:    Optional[Any]           =     model(a  ,     attention_mask=a  ,     labels=a			)
       self.parent.assertEqual(result.logits.shape  ,     (self.batch_size, self.seq_length, self.num_labels)			)





    def 				lowerCAmelCase__				(			self  :       Dict			):






       '''simple docstring'''






       lowercase_	:    str           =     self.prepare_config_and_inputs()
       ((lowercase_)    ,		(lowercase_)    ,		(lowercase_)    ,		(lowercase_)    ,		(lowercase_)    ,		(lowercase_))	:    Dict           =     config_and_inputs
       lowercase_	:    List[str]           =     {"input_ids": input_ids, "attention_mask": input_mask}
       return config, inputs_dict


@require_torch
class        _UpperCAmelCase						(		snake_case				,					snake_case				,					unittest.TestCase			):
    __lowerCamelCase:   Union[str, Any]		       =    (
        (
            MPNetForMaskedLM,
            MPNetForMultipleChoice,
            MPNetForQuestionAnswering,
            MPNetForSequenceClassification,
            MPNetForTokenClassification,
            MPNetModel,
        )
        if is_torch_available()
        else ()
    )
    __lowerCamelCase:   Union[str, Any]		       =    (
        {
            'feature-extraction': MPNetModel,
            'fill-mask': MPNetForMaskedLM,
            'question-answering': MPNetForQuestionAnswering,
            'text-classification': MPNetForSequenceClassification,
            'token-classification': MPNetForTokenClassification,
            'zero-shot': MPNetForSequenceClassification,
        }
        if is_torch_available()
        else {}
    )
    __lowerCamelCase:   List[str]		       =    False
    __lowerCamelCase:   Optional[int]		       =    True




    def 				lowerCAmelCase__				(			self  :       int			):






       '''simple docstring'''






       lowercase_	:    int           =     MPNetModelTester(self			)
       lowercase_	:    List[str]           =     ConfigTester(self  ,     config_class=a  ,     hidden_size=3_7			)




    def 				lowerCAmelCase__				(			self  :       Optional[Any]			):






       '''simple docstring'''






       self.config_tester.run_common_tests()




    def 				lowerCAmelCase__				(			self  :       Tuple			):






       '''simple docstring'''






       lowercase_	:    int           =     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_mpnet_model(*a			)




    def 				lowerCAmelCase__				(			self  :       Tuple			):






       '''simple docstring'''






       lowercase_	:    Dict           =     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_mpnet_for_sequence_classification(*a			)




    def 				lowerCAmelCase__				(			self  :       List[Any]			):






       '''simple docstring'''






       lowercase_	:    Tuple           =     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_mpnet_for_multiple_choice(*a			)




    def 				lowerCAmelCase__				(			self  :       List[Any]			):






       '''simple docstring'''






       lowercase_	:    Dict           =     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_mpnet_for_token_classification(*a			)





    def 				lowerCAmelCase__				(			self  :       List[str]			):






       '''simple docstring'''






       lowercase_	:    str           =     self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_mpnet_for_question_answering(*a			)


@require_torch
class        _UpperCAmelCase						(		unittest.TestCase			):




    @slow
    def 				lowerCAmelCase__				(			self  :       Union[str, Any]			):






       '''simple docstring'''






       lowercase_	:    Any           =     MPNetModel.from_pretrained("microsoft/mpnet-base"			)
       lowercase_	:    List[Any]           =     torch.tensor([[0, 3_4_5, 2_3_2, 3_2_8, 7_4_0, 1_4_0, 1_6_9_5, 6_9, 6_0_7_8, 1_5_8_8, 2]]			)
       lowercase_	:    str           =     model(a			)[0]
       lowercase_	:    int           =     torch.Size((1, 1_1, 7_6_8)			)
       self.assertEqual(output.shape  ,     a			)
       lowercase_	:    int           =     torch.tensor(
           [[[-0.0550, 0.1943, -0.0740], [-0.0562, 0.2211, -0.0579], [-0.0437, 0.3337, -0.0641]]]			)
       # compare the actual values for a slice.
       self.assertTrue(torch.allclose(output[:, :3, :3]  ,     a  ,     atol=1e-4			)			)












'''simple docstring'''
def 		__SCREAMING_SNAKE_CASE					(  _UpperCamelCase							):


   """simple docstring"""




   lowercase_	:    Any           =     False
   while is_sorted is False:  # Until all the indices are traversed keep looping
      lowercase_	:    List[str]           =     True
      for i in range(0						,		len(_UpperCamelCase							) - 1						,		2							):  # iterating over all even indices
         if input_list[i] > input_list[i + 1]:
            lowercase_    ,		lowercase_	:    Union[str, Any]           =     input_list[i + 1], input_list[i]
            # swapping if elements not in order
            lowercase_	:    Any           =     False

      for i in range(1						,		len(_UpperCamelCase							) - 1						,		2							):  # iterating over all odd indices
         if input_list[i] > input_list[i + 1]:
            lowercase_    ,		lowercase_	:    Tuple           =     input_list[i + 1], input_list[i]
            # swapping if elements not in order
            lowercase_	:    List[Any]           =     False
   return input_list


if __name__ == "__main__":
 print('Enter list to be sorted')
 UpperCamelCase__ =			[int(x) for x in input().split()]
 # inputing elements of the list in one line
 UpperCamelCase__ =			odd_even_sort(input_list)
 print('The sorted list is')
 print(sorted_list)




