


'''simple docstring'''





import unittest
from timeit import timeit


def 					a__    (				UpperCamelCase_	:			List[str],      UpperCamelCase_	:			List[Any]	):
   UpperCAmelCase__  :int            =			first_num if first_num >= second_num else second_num
   UpperCAmelCase__  :Dict            =			max_num
   while (common_mult % first_num > 0) or (common_mult % second_num > 0):
      common_mult += max_num
   return common_mult


def 					a__    (				UpperCamelCase_	:			int,      UpperCamelCase_	:			Optional[Any]	):
   return b if a == 0 else greatest_common_divisor(b % a,      SCREAMING_SNAKE_CASE__	)


def 					a__    (				UpperCamelCase_	:			Tuple,      UpperCamelCase_	:			Any	):
   return first_num // greatest_common_divisor(SCREAMING_SNAKE_CASE__,      SCREAMING_SNAKE_CASE__	) * second_num


def 					a__    (				):
   UpperCAmelCase__  :int            =			(
       '''from __main__ import least_common_multiple_slow, least_common_multiple_fast'''
   )
   print(
       '''least_common_multiple_slow():''',      timeit('''least_common_multiple_slow(1000, 999)''',      setup=SCREAMING_SNAKE_CASE__	),      )
   print(
       '''least_common_multiple_fast():''',      timeit('''least_common_multiple_fast(1000, 999)''',      setup=SCREAMING_SNAKE_CASE__	),      )




class 							UpperCAmelCase ( unittest.TestCase	):
 UpperCAmelCase				=				(
     (10, 20),
     (13, 15),
     (4, 31),
     (10, 42),
     (43, 34),
     (5, 12),
     (12, 25),
     (10, 25),
     (6, 9),
 )
 UpperCAmelCase				=				(20, 195, 124, 210, 1_462, 60, 300, 50, 18)


 def 					__SCREAMING_SNAKE_CASE				(			self       :  Tuple   ):







    for i, (first_num, second_num) in enumerate(self.test_inputs   ):
       UpperCAmelCase__  :str            =			least_common_multiple_slow(UpperCamelCase__ ,					UpperCamelCase__   )
       UpperCAmelCase__  :Dict            =			least_common_multiple_fast(UpperCamelCase__ ,					UpperCamelCase__   )
       with self.subTest(i=UpperCamelCase__   ):
          self.assertEqual(UpperCamelCase__ ,					self.expected_results[i]   )
          self.assertEqual(UpperCamelCase__ ,					self.expected_results[i]   )


if __name__ == "__main__":
 benchmark()
 unittest.main()







'''simple docstring'''





from typing import List, Optional, Tuple, Union

from . import logging
from .import_utils import is_torch_available, is_torch_version


if is_torch_available():
    import torch

__lowerCamelCase       				=	logging.get_logger(__name__)  # pylint: disable=invalid-name

try:
    from torch._dynamo import allow_in_graph as maybe_allow_in_graph
except (ImportError, ModuleNotFoundError):


    def 					a__    (				cls	:			Optional[int]	):
       return cls


def 					a__    (				UpperCamelCase_	:			Union[Tuple, List],      UpperCamelCase_	:			Optional[Union[List["torch.Generator"], "torch.Generator"]] = None,      UpperCamelCase_	:			Optional["torch.device"] = None,      UpperCamelCase_	:			Optional["torch.dtype"] = None,      UpperCamelCase_	:			Optional["torch.layout"] = None,      ):
   UpperCAmelCase__  :Union[str, Any]            =			device
   UpperCAmelCase__  :List[Any]            =			shape[0]

   UpperCAmelCase__  :Tuple            =			layout or torch.strided
   UpperCAmelCase__  :Union[str, Any]            =			device or torch.device('''cpu'''	)

   if generator is not None:
      UpperCAmelCase__  :str            =			generator.device.type if not isinstance(UpperCamelCase_,      UpperCamelCase_	) else generator[0].device.type
      if gen_device_type != device.type and gen_device_type == "cpu":
         UpperCAmelCase__  :Tuple            =			'''cpu'''
         if device != "mps":
            logger.info(
                F'''The passed generator was created on \'cpu\' even though a tensor on {device} was expected.'''
                F''' Tensors will be created on \'cpu\' and then moved to {device}. Note that one can probably'''
                F''' slighly speed up this function by passing a generator that was created on the {device} device.'''	)
      elif gen_device_type != device.type and gen_device_type == "cuda":
         raise ValueError(F'''Cannot generate a {device} tensor from a generator of type {gen_device_type}.'''	)

   if isinstance(UpperCamelCase_,      UpperCamelCase_	):
      UpperCAmelCase__  :List[str]            =			(1,) + shape[1:]
      UpperCAmelCase__  :Optional[int]            =			[
          torch.randn(UpperCamelCase_,      generator=generator[i],      device=UpperCamelCase_,      dtype=UpperCamelCase_,      layout=UpperCamelCase_	)
          for i in range(UpperCamelCase_	)
      ]
      UpperCAmelCase__  :int            =			torch.cat(UpperCamelCase_,      dim=0	).to(UpperCamelCase_	)
   else:
      UpperCAmelCase__  :Optional[int]            =			torch.randn(UpperCamelCase_,      generator=UpperCamelCase_,      device=UpperCamelCase_,      dtype=UpperCamelCase_,      layout=UpperCamelCase_	).to(UpperCamelCase_	)

   return latents


def 					a__    (				UpperCamelCase_	:			Dict	):
   if is_torch_version('''<''',      '''2.0.0'''	) or not hasattr(UpperCamelCase_,      '''_dynamo'''	):
      return False
   return isinstance(UpperCamelCase_,      torch._dynamo.eval_frame.OptimizedModule	)



