


from collections import OrderedDict
from typing import Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...feature_extraction_utils import FeatureExtractionMixin
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...tokenization_utils_base import PreTrainedTokenizerBase
from ...utils import TensorType, logging


a					  =     logging.get_logger(__name__)

a					  =     {
    'deepmind/language-perceiver': 'https://huggingface.co/deepmind/language-perceiver/resolve/main/config.json',
    # See all Perceiver models at https://huggingface.co/models?filter=perceiver
}







class        UpperCamelCase__   (	__magic_name__   ):
					__SCREAMING_SNAKE_CASE       :  Any						=   'perceiver'

					def __init__(     self       :   int							,					UpperCamelCase__       :   Dict=256							,					UpperCamelCase__       :   int=1_280							,					UpperCamelCase__       :   Dict=768							,					UpperCamelCase__       :   List[Any]=1							,					UpperCamelCase__       :   Any=26							,					UpperCamelCase__       :   List[Any]=8							,					UpperCamelCase__       :   int=8							,					UpperCamelCase__       :   str=None							,					UpperCamelCase__       :   Optional[int]=None							,					UpperCamelCase__       :   List[Any]="kv"							,					UpperCamelCase__       :   Union[str, Any]=1							,					UpperCamelCase__       :   List[str]=1							,					UpperCamelCase__       :   Union[str, Any]="gelu"							,					UpperCamelCase__       :   Tuple=0.1							,					UpperCamelCase__       :   List[Any]=0.02							,					UpperCamelCase__       :   Tuple=1e-12							,					UpperCamelCase__       :   Any=True							,					UpperCamelCase__       :   Any=262							,					UpperCamelCase__       :   Optional[int]=2_048							,					UpperCamelCase__       :   Optional[int]=56							,					UpperCamelCase__       :   Union[str, Any]=[368, 496]							,					UpperCamelCase__       :   Optional[Any]=16							,					UpperCamelCase__       :   Tuple=1_920							,					UpperCamelCase__       :   List[Any]=16							,					UpperCamelCase__       :   List[str]=[1, 16, 224, 224]							,					**UpperCamelCase__       :   Optional[Any]							,					):






										'''simple docstring'''






										super().__init__(**UpperCamelCase__       )

										lowercase_  							=			num_latents
										lowercase_  							=			d_latents
										lowercase_  							=			d_model
										lowercase_  							=			num_blocks
										lowercase_  							=			num_self_attends_per_block
										lowercase_  							=			num_self_attention_heads
										lowercase_  							=			num_cross_attention_heads
										lowercase_  							=			qk_channels
										lowercase_  							=			v_channels
										lowercase_  							=			cross_attention_shape_for_attention
										lowercase_  							=			self_attention_widening_factor
										lowercase_  							=			cross_attention_widening_factor
										lowercase_  							=			hidden_act
										lowercase_  							=			attention_probs_dropout_prob
										lowercase_  							=			initializer_range
										lowercase_  							=			layer_norm_eps
										lowercase_  							=			use_query_residual
										# masked language modeling attributes
										lowercase_  							=			vocab_size
										lowercase_  							=			max_position_embeddings
										# image classification attributes
										lowercase_  							=			image_size
										# flow attributes
										lowercase_  							=			train_size
										# multimodal autoencoding attributes
										lowercase_  							=			num_frames
										lowercase_  							=			audio_samples_per_frame
										lowercase_  							=			samples_per_patch
										lowercase_  							=			output_shape







class        UpperCamelCase__   (	__magic_name__   ):

					@property
					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										if self.task == "multiple-choice":
															lowercase_  							=			{0: """batch""", 1: """choice""", 2: """sequence"""}
										else:
															lowercase_  							=			{0: """batch""", 1: """sequence"""}
										return OrderedDict(
										    [
										        ("""inputs""", dynamic_axis),
										        ("""attention_mask""", dynamic_axis),
										    ]       )

					@property
					def   UpperCAmelCase__       (     self       :   Tuple       ):






										'''simple docstring'''






										return 1e-4







					def   UpperCAmelCase__       (     self       :   Union[str, Any]							,					UpperCamelCase__       :   Union["PreTrainedTokenizerBase", "FeatureExtractionMixin"]							,					UpperCamelCase__       :   int = -1							,					UpperCamelCase__       :   int = -1							,					UpperCamelCase__       :   int = -1							,					UpperCamelCase__       :   bool = False							,					UpperCamelCase__       :   Optional[TensorType] = None							,					UpperCamelCase__       :   int = 3							,					UpperCamelCase__       :   int = 40							,					UpperCamelCase__       :   int = 40							,					):






										'''simple docstring'''






										if isinstance(UpperCamelCase__							,					UpperCamelCase__       ):
															# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
															lowercase_  							=			compute_effective_axis_dimension(
															    UpperCamelCase__							,					fixed_dimension=OnnxConfig.default_fixed_batch							,					num_token_to_add=0       )
															# If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
															lowercase_  							=			preprocessor.num_special_tokens_to_add(UpperCamelCase__       )
															lowercase_  							=			compute_effective_axis_dimension(
															    UpperCamelCase__							,					fixed_dimension=OnnxConfig.default_fixed_sequence							,					num_token_to_add=UpperCamelCase__       )
															# Generate dummy inputs according to compute batch and sequence
															lowercase_  							=			[""" """.join(["""a"""]       ) * seq_length] * batch_size
															lowercase_  							=			dict(preprocessor(UpperCamelCase__							,					return_tensors=UpperCamelCase__       )       )
															lowercase_  							=			inputs.pop("""input_ids"""       )
															return inputs
										elif isinstance(UpperCamelCase__							,					UpperCamelCase__       ) and preprocessor.model_input_names[0] == "pixel_values":
															# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
															lowercase_  							=			compute_effective_axis_dimension(UpperCamelCase__							,					fixed_dimension=OnnxConfig.default_fixed_batch       )
															lowercase_  							=			self._generate_dummy_images(UpperCamelCase__							,					UpperCamelCase__							,					UpperCamelCase__							,					UpperCamelCase__       )
															lowercase_  							=			dict(preprocessor(images=UpperCamelCase__							,					return_tensors=UpperCamelCase__       )       )
															lowercase_  							=			inputs.pop("""pixel_values"""       )
															return inputs
										else:
															raise ValueError(
															    """Unable to generate dummy inputs for the model. Please provide a tokenizer or a preprocessor."""       )






def 			UpperCAmelCase_				(      UpperCAmelCase__=2_8_1_2_3  ):
					lowercase_  							=			[1] * (limit + 1)

					for i in range(2						,							int(limit**0.5  ) + 1  ):
										sum_divs[i * i] += i
										for k in range(i + 1						,							limit // i + 1  ):
															sum_divs[k * i] += k + i

					lowercase_  							=			set()
					lowercase_  							=			0

					for n in range(1						,							limit + 1  ):
										if sum_divs[n] > n:
															abundants.add(UpperCAmelCase__  )

										if not any((n - a in abundants) for a in abundants  ):
															res += n

					return res


if __name__ == "__main__":
							print(solution())


