






import unittest

import torch

from diffusers import VQModel
from diffusers.utils import floats_tensor, torch_device
from diffusers.utils.testing_utils import enable_full_determinism

from .test_modeling_common import ModelTesterMixin, UNetTesterMixin


enable_full_determinism()
class    _UpperCAmelCase      ( a__	,a__	,unittest.TestCase			):

				"""simple docstring"""




				lowercase__       							= VQModel
				lowercase__       							= """sample"""




				@property
				def        lowercase__     (  self		:					Optional[int],						lowerCamelCase		:					Dict=(32, 32)						):

								'''simple docstring'''
								lowercase__     				=    4
								lowercase__     				=    3

								lowercase__     				=    floats_tensor((batch_size, num_channels) + sizes						).to(lowerCAmelCase__						)

								return {"sample": image}




				@property
				def        lowercase__     (  self		:					Optional[int]						):

								'''simple docstring'''
								return (3, 32, 32)




				@property
				def        lowercase__     (  self		:					List[Any]						):

								'''simple docstring'''
								return (3, 32, 32)




				def        lowercase__     (  self		:					Dict						):

								'''simple docstring'''
								lowercase__     				=    {
								    "block_out_channels": [32, 64],
								    "in_channels": 3,
								    "out_channels": 3,
								    "down_block_types": ["DownEncoderBlock2D", "DownEncoderBlock2D"],
								    "up_block_types": ["UpDecoderBlock2D", "UpDecoderBlock2D"],
								    "latent_channels": 3,
								}
								lowercase__     				=    self.dummy_input
								return init_dict, inputs_dict




				def        lowercase__     (  self		:					str						):

								'''simple docstring'''
								pass




				def        lowercase__     (  self		:					List[Any]						):

								'''simple docstring'''
								pass




				def        lowercase__     (  self		:					Tuple						):

								'''simple docstring'''
								lowercase__     				=    VQModel.from_pretrained('''fusing/vqgan-dummy''',						output_loading_info=lowerCAmelCase__						)
								self.assertIsNotNone(lowerCAmelCase__						)
								self.assertEqual(len(loading_info['''missing_keys''']						),						0						)

								model.to(lowerCAmelCase__						)
								lowercase__     				=    model(**self.dummy_input						)

								assert image is not None, "Make sure output is not None"




				def        lowercase__     (  self		:					Union[str, Any]						):

								'''simple docstring'''
								lowercase__     				=    VQModel.from_pretrained('''fusing/vqgan-dummy'''						)
								model.to(lowerCAmelCase__						).eval()

								torch.manual_seed(0						)
								if torch.cuda.is_available():
												torch.cuda.manual_seed_all(0						)

								lowercase__     				=    torch.randn(1,						model.config.in_channels,						model.config.sample_size,						model.config.sample_size						)
								lowercase__     				=    image.to(lowerCAmelCase__						)
								with torch.no_grad():
												lowercase__     				=    model(lowerCAmelCase__						).sample

								lowercase__     				=    output[0, -1, -3:, -3:].flatten().cpu()
								# fmt: off
								lowercase__     				=    torch.tensor([-0.0153, -0.4044, -0.1880, -0.5161, -0.2418, -0.4072, -0.1612, -0.0633, -0.0143]						)
								# fmt: on
								self.assertTrue(torch.allclose(lowerCAmelCase__,						lowerCAmelCase__,						atol=1E-3						)						)












from itertools import count






def 						a    (		lowerCamelCase_ = 50       ):






				'''simple docstring'''
				lowercase__     				=    [1] * min_block_length

				for n in count(lowerCamelCase_       ):
								fill_count_functions.append(1       )

								for block_length in range(lowerCamelCase_	,     n + 1       ):
												for block_start in range(n - block_length       ):
																fill_count_functions[n] += fill_count_functions[
																    n - block_start - block_length - 1
																]

												fill_count_functions[n] += 1

								if fill_count_functions[n] > 100_0000:
												break

				return n


if __name__ == "__main__":
							print(F"{solution() = }")




