


'''simple docstring'''
import inspect
import unittest

from transformers import is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
						import torch

						from transformers import MODEL_MAPPING, PoolFormerConfig, PoolFormerForImageClassification, PoolFormerModel
						from transformers.models.poolformer.modeling_poolformer import POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
						from PIL import Image

						from transformers import PoolFormerImageProcessor






class 		UpperCamelCase_		(					A   ):





						"""simple docstring"""




						def 					__A					( self				:					Optional[int]  )							->					Tuple:
										__magic_name__	  = self.config_class(**self.inputs_dict  )
										self.parent.assertTrue(hasattr(_lowerCamelCase	,				"hidden_sizes"  )  )
										self.parent.assertTrue(hasattr(_lowerCamelCase	,				"num_encoder_blocks"  )  )






class 		UpperCamelCase_		:





						"""simple docstring"""




						def __init__( self				:					str	,				_lowerCamelCase				:					Union[str, Any]	,				_lowerCamelCase				:					Tuple=13	,				_lowerCamelCase				:					List[str]=64	,				_lowerCamelCase				:					int=3	,				_lowerCamelCase				:					Optional[Any]=4	,				_lowerCamelCase				:					Tuple=[2, 2, 2, 2]	,				_lowerCamelCase				:					str=[8, 4, 2, 1]	,				_lowerCamelCase				:					Optional[int]=[16, 32, 64, 1_28]	,				_lowerCamelCase				:					str=[1, 4, 8, 16]	,				_lowerCamelCase				:					Dict=False	,				_lowerCamelCase				:					Tuple=True	,				_lowerCamelCase				:					Any="gelu"	,				_lowerCamelCase				:					Union[str, Any]=0.1	,				_lowerCamelCase				:					Optional[Any]=0.02	,				_lowerCamelCase				:					Optional[Any]=3	,				_lowerCamelCase				:					Union[str, Any]=None	,				)							->					Optional[int]:
										__magic_name__	  = parent
										__magic_name__	  = batch_size
										__magic_name__	  = image_size
										__magic_name__	  = num_channels
										__magic_name__	  = num_encoder_blocks
										__magic_name__	  = sr_ratios
										__magic_name__	  = depths
										__magic_name__	  = hidden_sizes
										__magic_name__	  = downsampling_rates
										__magic_name__	  = is_training
										__magic_name__	  = use_labels
										__magic_name__	  = hidden_act
										__magic_name__	  = hidden_dropout_prob
										__magic_name__	  = initializer_range
										__magic_name__	  = num_labels
										__magic_name__	  = scope
						def 					__A					( self				:					int  )							->					Optional[Any]:
										__magic_name__	  = floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]  )

										__magic_name__	  = None
										if self.use_labels:
														__magic_name__	  = ids_tensor([self.batch_size, self.image_size, self.image_size]	,				self.num_labels  )

										__magic_name__	  = PoolFormerConfig(
										    image_size=self.image_size	,				num_channels=self.num_channels	,				num_encoder_blocks=self.num_encoder_blocks	,				depths=self.depths	,				hidden_sizes=self.hidden_sizes	,				hidden_act=self.hidden_act	,				hidden_dropout_prob=self.hidden_dropout_prob	,				initializer_range=self.initializer_range	,				)

										return config, pixel_values, labels
						def 					__A					( self				:					str	,				_lowerCamelCase				:					Optional[int]	,				_lowerCamelCase				:					Optional[int]	,				_lowerCamelCase				:					List[str]  )							->					Any:
										__magic_name__	  = PoolFormerModel(config=_lowerCamelCase  )
										model.to(_lowerCamelCase  )
										model.eval()
										__magic_name__	  = model(_lowerCamelCase  )
										__magic_name__	  = __magic_name__	  = self.image_size // 32.0
										self.parent.assertEqual(
										    result.last_hidden_state.shape	,				(self.batch_size, self.hidden_sizes[-1], expected_height, expected_width)  )

						def 					__A					( self				:					Optional[Any]  )							->					Optional[int]:
										__magic_name__	  = self.prepare_config_and_inputs()
										__magic_name__  ,      __magic_name__  ,      __magic_name__	  = config_and_inputs
										__magic_name__	  = {"pixel_values": pixel_values}
										return config, inputs_dict






@require_torch
class 		UpperCamelCase_		(					A   ,		A   ,		unittest.TestCase   ):





						"""simple docstring"""




						UpperCAmelCase__	:       Tuple         =     (PoolFormerModel, PoolFormerForImageClassification) if is_torch_available() else ()
						UpperCAmelCase__	:       List[Any]         =     (
						    {'''feature-extraction''': PoolFormerModel, '''image-classification''': PoolFormerForImageClassification}
						    if is_torch_available()
						    else {}
						)

						UpperCAmelCase__	:       int         =     False
						UpperCAmelCase__	:       Dict         =     False
						UpperCAmelCase__	:       Dict         =     False
						UpperCAmelCase__	:       Optional[Any]         =     False
						UpperCAmelCase__	:       List[Any]         =     False
						def 					__A					( self				:					Any  )							->					Dict:
										__magic_name__	  = PoolFormerModelTester(self  )
										__magic_name__	  = PoolFormerConfigTester(self	,				config_class=_lowerCamelCase  )
						def 					__A					( self				:					List[str]  )							->					List[str]:
										self.config_tester.run_common_tests()
						def 					__A					( self				:					List[str]  )							->					Union[str, Any]:
										__magic_name__	  = self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_model(*_lowerCamelCase  )
						@unittest.skip("PoolFormer does not use inputs_embeds"  )
						def 					__A					( self				:					Union[str, Any]  )							->					Optional[int]:
										pass
						@unittest.skip("PoolFormer does not have get_input_embeddings method and get_output_embeddings methods"  )
						def 					__A					( self				:					Tuple  )							->					Optional[int]:
										pass
						def 					__A					( self				:					List[Any]  )							->					Any:
										def check_hidden_states_output(_lowerCamelCase				:					Tuple	,				_lowerCamelCase				:					List[str]	,				_lowerCamelCase				:					List[Any]  ):
														__magic_name__	  = model_class(_lowerCamelCase  )
														model.to(_lowerCamelCase  )
														model.eval()

														with torch.no_grad():
																		__magic_name__	  = model(**self._prepare_for_class(_lowerCamelCase	,				_lowerCamelCase  )  )

														__magic_name__	  = outputs.hidden_states

														__magic_name__	  = self.model_tester.num_encoder_blocks
														self.assertEqual(len(_lowerCamelCase  )	,				_lowerCamelCase  )

														# verify the first hidden states (first block)
														self.assertListEqual(
														    list(hidden_states[0].shape[-3:]  )	,				[
														        self.model_tester.hidden_sizes[0],
														        self.model_tester.image_size // 4,
														        self.model_tester.image_size // 4,
														    ]	,				)

										__magic_name__  ,      __magic_name__	  = self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														__magic_name__	  = True
														check_hidden_states_output(_lowerCamelCase	,				_lowerCamelCase	,				_lowerCamelCase  )

														# check that output_hidden_states also work using config
														del inputs_dict["output_hidden_states"]
														__magic_name__	  = True

														check_hidden_states_output(_lowerCamelCase	,				_lowerCamelCase	,				_lowerCamelCase  )
						def 					__A					( self				:					Dict  )							->					Any:
										if not self.model_tester.is_training:
														return

										__magic_name__  ,      __magic_name__	  = self.model_tester.prepare_config_and_inputs_for_common()
										__magic_name__	  = True

										for model_class in self.all_model_classes:
														if model_class in get_values(_lowerCamelCase  ):
																		continue
														__magic_name__	  = model_class(_lowerCamelCase  )
														model.to(_lowerCamelCase  )
														model.train()
														__magic_name__	  = self._prepare_for_class(_lowerCamelCase	,				_lowerCamelCase	,				return_labels=_lowerCamelCase  )
														__magic_name__	  = model(**_lowerCamelCase  ).loss
														loss.backward()
						def 					__A					( self				:					Any  )							->					str:
										__magic_name__  ,      __magic_name__	  = self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														__magic_name__	  = model_class(_lowerCamelCase  )
														__magic_name__	  = inspect.signature(model.forward  )
														# signature.parameters is an OrderedDict => so arg_names order is deterministic
														__magic_name__	  = [*signature.parameters.keys()]

														__magic_name__	  = ["pixel_values"]
														self.assertListEqual(arg_names[:1]	,				_lowerCamelCase  )

						@slow
						def 					__A					( self				:					List[Any]  )							->					Optional[int]:
										for model_name in POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														__magic_name__	  = PoolFormerModel.from_pretrained(_lowerCamelCase  )
														self.assertIsNotNone(_lowerCamelCase  )





def      __snake_case       (       ):
				'''simple docstring'''




				__magic_name__	  = Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"						)
				return image






@require_torch
class 		UpperCamelCase_		(					unittest.TestCase   ):





						"""simple docstring"""




						@slow
						def 					__A					( self				:					List[Any]  )							->					List[str]:
										__magic_name__	  = PoolFormerImageProcessor()
										__magic_name__	  = PoolFormerForImageClassification.from_pretrained("sail/poolformer_s12"  ).to(_lowerCamelCase  )

										__magic_name__	  = image_processor(images=prepare_img()	,				return_tensors="pt"  ).to(_lowerCamelCase  )

										# forward pass
										with torch.no_grad():
														__magic_name__	  = model(**_lowerCamelCase  )

										# verify the logits
										__magic_name__	  = torch.Size((1, 10_00)  )
										self.assertEqual(outputs.logits.shape	,				_lowerCamelCase  )

										__magic_name__	  = torch.tensor([-0.6_113, 0.1_685, -0.0_492]  ).to(_lowerCamelCase  )
										self.assertTrue(torch.allclose(outputs.logits[0, :3]	,				_lowerCamelCase	,				atol=1e-4  )  )







'''simple docstring'''
def      __snake_case       (       lowerCamelCase_ :				int = 100						):
				'''simple docstring'''




				__magic_name__	  = [[0 for _ in range(lowerCamelCase_						)] for _ in range(m + 1						)]
				for i in range(m + 1						):
								__magic_name__	  = 1

				for n in range(m + 1						):
								for k in range(1	,  lowerCamelCase_						):
												memo[n][k] += memo[n][k - 1]
												if n > k:
																memo[n][k] += memo[n - k - 1][k]

				return memo[m][m - 1] - 1


if __name__ == "__main__":
						print(solution(int(input('Enter a number: ').strip())))



