





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



      def 						lowerCAmelCase__     (						self:    Optional[int]							)    ->     List[str]:
         '''simple docstring'''

         UpperCAmelCase_           =torch.nn.Linear(10		,	10							)
         UpperCAmelCase_           =torch.optim.SGD(model.parameters()		,	0.1							)
         UpperCAmelCase_           =Accelerator()
         UpperCAmelCase_           =accelerator.prepare(_lowerCAmelCase							)
         try:
            pickle.loads(pickle.dumps(_lowerCAmelCase							)							)
         except Exception as e:
            self.fail(F'Accelerated optimizer pickling failed with {e}'							)
         AcceleratorState._reset_state()






'''simple docstring'''
import numpy as np







def 		A_(     A						:		str		,     A						:		Optional[Any]		,     A						:		Tuple		,     A						:		Optional[int]		,     A						:		str):
							UpperCamelCase   			=     int(np.ceil((x_end - xa) / h))
							UpperCamelCase   			=     np.zeros((n + 1,))
							UpperCamelCase   			=     ya
							UpperCamelCase   			=     xa

							for k in range(A):
														UpperCamelCase   			=     f(A		,     y[k])
														UpperCamelCase   			=     f(x + 0.5 * h		,     y[k] + 0.5 * h * ka)
														UpperCamelCase   			=     f(x + 0.5 * h		,     y[k] + 0.5 * h * ka)
														UpperCamelCase   			=     f(x + h		,     y[k] + h * ka)
														UpperCamelCase   			=     y[k] + (1 / 6) * h * (ka + 2 * ka + 2 * ka + ka)
														x += h

							return y


if __name__ == "__main__":
						import doctest

						doctest.testmod()




