






"""simple docstring"""



def 	SCREAMING_SNAKE_CASE__       (  snake_case       : List[str]				)->		List[Any]:






     '''simple docstring'''



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


def 	SCREAMING_SNAKE_CASE__       (  snake_case       : Optional[Any]				)->		Tuple:






     '''simple docstring'''



     def backtrack(snake_case       : Union[str, Any]				):
          if start == len(snake_case__				) - 1:
               output.append(nums[:]				)
          else:
               for i in range(snake_case__			,					len(snake_case__				)				):
                    UpperCAmelCase__							,				UpperCAmelCase__						:    Any							=							nums[i], nums[start]
                    backtrack(start + 1				)
                    UpperCAmelCase__							,				UpperCAmelCase__						:    str							=							nums[i], nums[start]  # backtrack

     UpperCAmelCase__						:    Optional[Any]							=							[]
     backtrack(0				)
     return output


if __name__ == "__main__":
 import doctest

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





"""simple docstring"""




import pickle
import unittest

import torch

from accelerate import Accelerator
from accelerate.state import AcceleratorState
from accelerate.test_utils import require_cpu





@require_cpu
class  lowerCamelCase    (unittest.TestCase      ):

			def        SCREAMING_SNAKE_CASE					(       self					:    Dict							) ->     str:
						SCREAMING_SNAKE_CASE__										=   torch.nn.Linear(1_0     ,					1_0							)
						SCREAMING_SNAKE_CASE__										=   torch.optim.SGD(model.parameters()     ,					0.1							)
						SCREAMING_SNAKE_CASE__										=   Accelerator()
						SCREAMING_SNAKE_CASE__										=   accelerator.prepare(__UpperCAmelCase							)
						try:
									pickle.loads(pickle.dumps(__UpperCAmelCase							)							)
						except Exception as e:
									self.fail(F"""Accelerated optimizer pickling failed with {e}"""							)
						AcceleratorState._reset_state()


