




def SCREAMING_SNAKE_CASE       ( lowercase_		)     -> list[list[int]]:



       """simple docstring"""

       A__   				=					[]
       if len(lowercase_		) == 1:
              return [nums.copy()]
       for _ in range(len(lowercase_		)		):
              A__   				=					nums.pop(0		)
              A__   				=					permute(lowercase_		)
              for perm in permutations:
                     perm.append(lowercase_		)
              result.extend(lowercase_		)
              nums.append(lowercase_		)
       return result







def SCREAMING_SNAKE_CASE       ( lowercase_		)     -> List[str]:



       """simple docstring"""

       def backtrack(lowercase_		):
              if start == len(lowercase_		) - 1:
                     output.append(nums[:]		)
              else:
                     for i in range(lowercase_				,       len(lowercase_		)		):
                            A__				,							A__   				=					nums[i], nums[start]
                            backtrack(start + 1		)
                            A__				,							A__   				=					nums[i], nums[start]  # backtrack

       A__   				=					[]
       backtrack(0		)
       return output


if __name__ == "__main__":
  import doctest

  # use res to print the data in permute2 function
  _lowerCamelCase			:	List[str]							 =     permutea([1, 2, 3])
  print(res)
  doctest.testmod()








import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
  from transformers import AutoModelForSeqaSeqLM, AutoTokenizer


@require_torch
@require_sentencepiece
@require_tokenizers
class        UpperCamelCase_					(				unittest.TestCase  ):

    '''simple docstring'''






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





           '''simple docstring'''

           A__   				=					AutoModelForSeqaSeqLM.from_pretrained('''google/mt5-small'''      ,				return_dict=UpperCAmelCase__).to(UpperCAmelCase__)
           A__   				=					AutoTokenizer.from_pretrained('''google/mt5-small''')

           A__   				=					tokenizer('''Hello there'''      ,				return_tensors='''pt''').input_ids
           A__   				=					tokenizer('''Hi I am'''      ,				return_tensors='''pt''').input_ids

           A__   				=					model(input_ids.to(UpperCAmelCase__)      ,				labels=labels.to(UpperCAmelCase__)).loss
           A__   				=					-(labels.shape[-1] * loss.item())

           A__   				=					-84.9127
           self.assertTrue(abs(mtf_score - EXPECTED_SCORE) < 1e-4)


