






"""simple docstring"""







import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest





class      UpperCamelCase_       (				a_     ):
  _A				:    List[Any] =		(VQDiffusionScheduler,)



  def 						UpperCamelCase_ (					self       ,						**snake_case__ )	->	List[Any]:



         """simple docstring"""





         UpperCAmelCase					=	{
             """num_vec_classes""": 40_97,
             """num_train_timesteps""": 1_00,
         }

         config.update(**snake_case__ )
         return config



  def 						UpperCamelCase_ (					self       ,						snake_case__ )	->	Any:



         """simple docstring"""





         UpperCAmelCase					=	4
         UpperCAmelCase					=	8
         UpperCAmelCase					=	8

         UpperCAmelCase					=	torch.randint(0       ,						snake_case__       ,						(batch_size, height * width) )

         return sample



  @property
  def 						UpperCamelCase_ (					self )	->	List[str]:



         """simple docstring"""





         assert False



  def 						UpperCamelCase_ (					self       ,						snake_case__ )	->	List[str]:



         """simple docstring"""





         def model(snake_case__       ,						snake_case__       ,						*snake_case__ ):
                UpperCAmelCase			,				UpperCAmelCase					=	sample.shape
                UpperCAmelCase					=	torch.rand((batch_size, num_vec_classes - 1, num_latent_pixels) )
                UpperCAmelCase					=	F.log_softmax(logits.double()       ,						dim=1 ).float()
                return return_value

         return model



  def 						UpperCamelCase_ (					self )	->	Any:



         """simple docstring"""





         for timesteps in [2, 5, 1_00, 10_00]:
                self.check_over_configs(num_train_timesteps=snake_case__ )



  def 						UpperCamelCase_ (					self )	->	Any:



         """simple docstring"""





         for num_vec_classes in [5, 1_00, 10_00, 40_00]:
                self.check_over_configs(num_vec_classes=snake_case__ )



  def 						UpperCamelCase_ (					self )	->	Any:



         """simple docstring"""





         for t in [0, 50, 99]:
                self.check_over_forward(time_step=snake_case__ )



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



         """simple docstring"""





         pass








"""simple docstring"""







import unittest
from timeit import timeit






def 					_lowerCAmelCase				(					lowerCAmelCase		,					lowerCAmelCase						):







       '''simple docstring'''
       UpperCAmelCase					=	first_num if first_num >= second_num else second_num
       UpperCAmelCase					=	max_num
       while (common_mult % first_num > 0) or (common_mult % second_num > 0):
              common_mult += max_num
       return common_mult






def 					_lowerCAmelCase				(					lowerCAmelCase		,					lowerCAmelCase						):







       '''simple docstring'''
       return b if a == 0 else greatest_common_divisor(b % a		,					lowerCAmelCase						)






def 					_lowerCAmelCase				(					lowerCAmelCase		,					lowerCAmelCase						):







       '''simple docstring'''
       return first_num // greatest_common_divisor(lowerCAmelCase		,					lowerCAmelCase						) * second_num






def 					_lowerCAmelCase				(					):







       '''simple docstring'''
       UpperCAmelCase					=	(
           """from __main__ import least_common_multiple_slow, least_common_multiple_fast"""
       )
       print(
           """least_common_multiple_slow():"""		,					timeit("""least_common_multiple_slow(1000, 999)"""		,					setup=lowerCAmelCase						)		,					)
       print(
           """least_common_multiple_fast():"""		,					timeit("""least_common_multiple_fast(1000, 999)"""		,					setup=lowerCAmelCase						)		,					)





class      UpperCamelCase_       (				unittest.TestCase     ):
  _A				:    List[str] =		(
      (10, 20),
      (13, 15),
      (4, 31),
      (10, 42),
      (43, 34),
      (5, 12),
      (12, 25),
      (10, 25),
      (6, 9),
  )
  _A				:    int =		(20, 195, 124, 210, 1462, 60, 300, 50, 18)



  def 						UpperCamelCase_ (					self )	->	Any:



         """simple docstring"""





         for i, (first_num, second_num) in enumerate(self.test_inputs ):
                UpperCAmelCase					=	least_common_multiple_slow(snake_case__       ,						snake_case__ )
                UpperCAmelCase					=	least_common_multiple_fast(snake_case__       ,						snake_case__ )
                with self.subTest(i=snake_case__ ):
                       self.assertEqual(snake_case__       ,						self.expected_results[i] )
                       self.assertEqual(snake_case__       ,						self.expected_results[i] )


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