"""simple docstring"""






import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest


class 					UpperCAmelCase		(lowercase_						):



    """simple docstring"""

    _UpperCAmelCase			:List[str]							=				(VQDiffusionScheduler,)






    def _snake_case    (     self					,    **_UpperCAmelCase							):
       lowercase__:     Any      =   {
           '''num_vec_classes''': 4097,
           '''num_train_timesteps''': 100,
       }

       config.update(**_UpperCAmelCase							)
       return config






    def _snake_case    (     self					,    _UpperCAmelCase							):
       lowercase__:     Dict      =   4
       lowercase__:     Union[str, Any]      =   8
       lowercase__:     Optional[Any]      =   8

       lowercase__:     str      =   torch.randint(0					,    _UpperCAmelCase					,    (batch_size, height * width)							)

       return sample






    @property
    def _snake_case    (     self							):
       assert False






    def _snake_case    (     self					,    _UpperCAmelCase							):







       def model(_UpperCAmelCase					,    _UpperCAmelCase					,    *_UpperCAmelCase							):
          lowercase__,				lowercase__:     Union[str, Any]      =   sample.shape
          lowercase__:     Optional[Any]      =   torch.rand((batch_size, num_vec_classes - 1, num_latent_pixels)							)
          lowercase__:     Optional[int]      =   F.log_softmax(logits.double()					,    dim=1							).float()
          return return_value

       return model






    def _snake_case    (     self							):







       for timesteps in [2, 5, 100, 1000]:
          self.check_over_configs(num_train_timesteps=_UpperCAmelCase							)






    def _snake_case    (     self							):







       for num_vec_classes in [5, 100, 1000, 4000]:
          self.check_over_configs(num_vec_classes=_UpperCAmelCase							)






    def _snake_case    (     self							):







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






    def _snake_case    (     self							):
       pass

"""simple docstring"""






def SCREAMING_SNAKE_CASE__    (     __UpperCAmelCase				)						->						int:
   if not isinstance(__UpperCAmelCase ,					__UpperCAmelCase				):
      lowercase__:     Optional[int]      =   F"""Input value of [number={number}] must be an integer"""
      raise TypeError(__UpperCAmelCase				)
   if number < 1:
      raise ValueError('''Input must be a positive integer'''				)
   return number * (2 * number - 1)


if __name__ == "__main__":
       import doctest

       doctest.testmod()
