




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        __snake_case  (unittest.TestCase		):



				def       SCREAMING_SNAKE_CASE       (      self      :		Any      )  ->    Tuple:





								'''simple docstring'''




								_lowerCAmelCase    :    List[str]										=      torch.nn.Linear(10		,	10      )
								_lowerCAmelCase    :    int										=      torch.optim.SGD(model.parameters()		,	0.1      )
								_lowerCAmelCase    :    Optional[int]										=      Accelerator()
								_lowerCAmelCase    :    Optional[int]										=      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()







import numpy as np




def 							_UpperCAmelCase  (UpperCamelCase_ : np.array       ):
				'''simple docstring'''
				return (2 / (1 + np.exp(-2 * vector       ))) - 1


if __name__ == "__main__":
	import doctest

	doctest.testmod()

