




import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest

class 		lowercase_       (	lowerCAmelCase__				):
					__UpperCamelCase     	= (VQDiffusionScheduler,)




					def     _lowercase						(   self:		Dict,     **_lowercase:		List[str]):


									'''simple docstring'''


									__lowerCAmelCase					=  {
									    'num_vec_classes': 4097,
									    'num_train_timesteps': 100,
									}

									config.update(**_snake_case)
									return config




					def     _lowercase						(   self:		Any,     _lowercase:		Dict):


									'''simple docstring'''


									__lowerCAmelCase					=  4
									__lowerCAmelCase					=  8
									__lowerCAmelCase					=  8

									__lowerCAmelCase					=  torch.randint(0,     _snake_case,     (batch_size, height * width))

									return sample




					@property
					def     _lowercase						(   self:		Any):


									'''simple docstring'''


									assert False




					def     _lowercase						(   self:		Union[str, Any],     _lowercase:		List[str]):


									'''simple docstring'''


									def model(_lowercase:		List[str],     _lowercase:		Tuple,     *_lowercase:		Any):
													__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     _lowercase						(   self:		List[str]):


									'''simple docstring'''


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




					def     _lowercase						(   self:		Optional[Any]):


									'''simple docstring'''


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




					def     _lowercase						(   self:		Optional[int]):


									'''simple docstring'''


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







					def     _lowercase						(   self:		List[str]):


									'''simple docstring'''


									pass













def       _a   (							lowerCamelCase__				)  ->      list[int]:
 if len(lowerCamelCase__				) > 1:
  lowerCamelCase_							:    Optional[Any]							=     len(lowerCamelCase__				) // 2  # Finds the middle of the array
  lowerCamelCase_							:    int							=     arr[
      :middle_length
  ]  # Creates an array of the elements in the first half.
  lowerCamelCase_							:    List[Any]							=     arr[
      middle_length:
  ]  # Creates an array of the elements in the second half.
  lowerCamelCase_							:    Optional[Any]							=     len(lowerCamelCase__				)
  lowerCamelCase_							:    Optional[Any]							=     len(lowerCamelCase__				)
  merge(lowerCamelCase__				)  # Starts sorting the left.
  merge(lowerCamelCase__				)  # Starts sorting the right
  lowerCamelCase_							:    Dict							=     0  # Left Counter
  lowerCamelCase_							:    str							=     0  # Right Counter
  lowerCamelCase_							:    Tuple							=     0  # Position Counter
  while (
      left_index < left_size and right_index < right_size
  ):  # Runs until the lowers size of the left and right are sorted.
   if left_array[left_index] < right_array[right_index]:
    lowerCamelCase_							:    Optional[int]							=     left_array[left_index]
    left_index += 1
   else:
    lowerCamelCase_							:    Union[str, Any]							=     right_array[right_index]
    right_index += 1
   index += 1
  while (
      left_index < left_size
  ):  # Adds the left over elements in the left half of the array
   lowerCamelCase_							:    Tuple							=     left_array[left_index]
   left_index += 1
   index += 1
  while (
      right_index < right_size
  ):  # Adds the left over elements in the right half of the array
   lowerCamelCase_							:    Optional[int]							=     right_array[right_index]
   right_index += 1
   index += 1
 return arr


if __name__ == "__main__":
       import doctest

       doctest.testmod()
