



import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest





class       __lowerCAmelCase				(  snake_case__ ):
				__lowerCamelCase				=       (VQDiffusionScheduler,)




				def 							snake_case     (							self		,       **_snake_case	):



									"""simple docstring"""





									_lowerCAmelCase      			=					{
									    """num_vec_classes""": 4097,
									    """num_train_timesteps""": 100,
									}

									config.update(**__snake_case	)
									return config




				def 							snake_case     (							self		,       _snake_case	):



									"""simple docstring"""





									_lowerCAmelCase      			=					4
									_lowerCAmelCase      			=					8
									_lowerCAmelCase      			=					8

									_lowerCAmelCase      			=					torch.randint(0		,       __snake_case		,       (batch_size, height * width)	)

									return sample




				@property
				def 							snake_case     (							self	):



									"""simple docstring"""





									assert False




				def 							snake_case     (							self		,       _snake_case	):



									"""simple docstring"""





									def model(_snake_case		,       _snake_case		,       *_snake_case	):
														_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 							snake_case     (							self	):



									"""simple docstring"""





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




				def 							snake_case     (							self	):



									"""simple docstring"""





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




				def 							snake_case     (							self	):



									"""simple docstring"""





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




				def 							snake_case     (							self	):



									"""simple docstring"""





									pass





# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
A__			   = abspath(join(dirname(dirname(dirname(__file__))), """src"""))
sys.path.insert(1, git_repo_path)


# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="""ignore""", category=FutureWarning)


def 	_UpperCAmelCase       (   snake_case    ):





					"""simple docstring"""

					from transformers.testing_utils import pytest_addoption_shared

					pytest_addoption_shared(snake_case    )


def 	_UpperCAmelCase       (   snake_case    ):





					"""simple docstring"""

					from transformers.testing_utils import pytest_terminal_summary_main

					_lowerCAmelCase      			=					terminalreporter.config.getoption("""--make-reports"""    )
					if make_reports:
										pytest_terminal_summary_main(snake_case			,		id=snake_case    )



