


def 							_UpperCAmelCase				(UpperCamelCase__     :  int						):
       if a < 0:
              raise ValueError("Input value must be a positive integer"						)
       elif isinstance(UpperCamelCase__				,							UpperCamelCase__						):
              raise TypeError("Input value must be a 'int' type"						)
       return bin(UpperCamelCase__						).count("1"						)


if __name__ == "__main__":
    import doctest

    doctest.testmod()


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


  '''simple docstring'''







  def 							_lowercase							( self			: List[Any]    )			->	Union[str, Any]:







    """simple docstring"""






    __magic_name__				     =       torch.nn.Linear(10			,							10    )
    __magic_name__				     =       torch.optim.SGD(model.parameters()			,							0.1    )
    __magic_name__				     =       Accelerator()
    __magic_name__				     =       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()

