"""simple docstring"""







import inspect
import os
import unittest

import torch

import accelerate
from accelerate import debug_launcher
from accelerate.test_utils import (
    execute_subprocess_async,
    require_cpu,
    require_huggingface_suite,
    require_multi_gpu,
    require_single_gpu,
)
from accelerate.utils import patch_environment







@require_huggingface_suite
class  lowerCamelCase__ (	unittest.TestCase			):






    def     _UpperCamelCase							(			self ):
          UpperCAmelCase          =	inspect.getfile(accelerate.test_utils )
          UpperCAmelCase          =	os.path.sep.join(
              mod_file.split(os.path.sep )[:-1] + ["""scripts""", """external_deps""", """test_metrics.py"""] )

          from accelerate.test_utils.scripts.external_deps import test_metrics  # noqa: F401

          UpperCAmelCase          =	test_metrics






    @require_cpu
    def     _UpperCamelCase							(			self ):
          debug_launcher(self.test_metrics.main     ,num_processes=1 )






    @require_cpu
    def     _UpperCamelCase							(			self ):
          debug_launcher(self.test_metrics.main )






    @require_single_gpu
    def     _UpperCamelCase							(			self ):
          self.test_metrics.main()






    @require_multi_gpu
    def     _UpperCamelCase							(			self ):
          print(F'''Found {torch.cuda.device_count()} devices.''' )
          UpperCAmelCase          =	['''torchrun''', F'''--nproc_per_node={torch.cuda.device_count()}''', self.test_file_path]
          with patch_environment(omp_num_threads=1 ):
                execute_subprocess_async(__lowercase     ,env=os.environ.copy() )











"""simple docstring"""







import numpy as np

def _a			(		_snake_case							):







      """simple docstring"""






      return 1 / (1 + np.exp(-vector							))


if __name__ == "__main__":
  import doctest

  doctest.testmod()



