


import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest







class 					__lowercase					(       lowercase_     ):



  """simple docstring"""

  UpperCamelCase    :				List[str] 					=		(VQDiffusionScheduler,)







  def 				__A      (   self		,			**A  )     ->   Optional[Any]:







     '''simple docstring'''







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

     config.update(**A  )
     return config







  def 				__A      (   self		,			A  )     ->   Optional[Any]:







     '''simple docstring'''







     lowerCamelCase								=     4
     lowerCamelCase								=     8
     lowerCamelCase								=     8

     lowerCamelCase								=     torch.randint(0		,			A		,			(batch_size, height * width)  )

     return sample







  @property
  def 				__A      (   self  )     ->   int:







     '''simple docstring'''







     assert False







  def 				__A      (   self		,			A  )     ->   Optional[Any]:







     '''simple docstring'''







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

     return model







  def 				__A      (   self  )     ->   List[str]:







     '''simple docstring'''







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







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







     '''simple docstring'''







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







  def 				__A      (   self  )     ->   int:







     '''simple docstring'''







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







  def 				__A      (   self  )     ->   Dict:







     '''simple docstring'''







     pass





def   __lowerCamelCase	(       lowerCamelCase__		:	int = 100     ,       lowerCamelCase__		:	int = 100			):





			'''simple docstring'''




			return max(
			    sum(int(lowerCamelCase__			) for x in str(base**power			)			)
			    for base in range(lowerCamelCase__			)
			    for power in range(lowerCamelCase__			)			)


# Tests
if __name__ == "__main__":
		import doctest

		doctest.testmod()

