




from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
  import accelerate







def 				lowerCAmelCase_	(     snake_case_     ):
      if not is_accelerate_available():
            return method
      _A							:     Any			=						version.parse(accelerate.__version__     ).base_version
      if version.parse(snake_case_     ) < version.parse("""0.17.0"""     ):
            return method

      def wrapper(self,*snake_case_,**snake_case_     ):
            if hasattr(self,"""_hf_hook"""     ) and hasattr(self._hf_hook,"""pre_forward"""     ):
                  self._hf_hook.pre_forward(self     )
            return method(self,*snake_case_,**snake_case_     )

      return wrapper







def 				lowerCAmelCase_	(     snake_case_,snake_case_     ):
      while b:
            _A			,   _A							:     List[str]			=						b, a % b
      return a







def 				lowerCAmelCase_	(     snake_case_,snake_case_     ):
      return a if b == 0 else euclidean_gcd_recursive(snake_case_,a % b     )







def 				lowerCAmelCase_	(     ):
      print(f'''euclidean_gcd(3, 5) = {euclidean_gcd(3,5     )}'''     )
      print(f'''euclidean_gcd(5, 3) = {euclidean_gcd(5,3     )}'''     )
      print(f'''euclidean_gcd(1, 3) = {euclidean_gcd(1,3     )}'''     )
      print(f'''euclidean_gcd(3, 6) = {euclidean_gcd(3,6     )}'''     )
      print(f'''euclidean_gcd(6, 3) = {euclidean_gcd(6,3     )}'''     )

      print(f'''euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3,5     )}'''     )
      print(f'''euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5,3     )}'''     )
      print(f'''euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1,3     )}'''     )
      print(f'''euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3,6     )}'''     )
      print(f'''euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6,3     )}'''     )


if __name__ == "__main__":
  main()

