

"""simple docstring"""





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

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import logging


if TYPE_CHECKING:
  from ...processing_utils import ProcessorMixin
  from ...utils import TensorType


lowercase__				:Tuple				   =       logging.get_logger(__name__)

lowercase__				:List[str]				   =       {
    'microsoft/layoutlmv3-base': 'https://huggingface.co/microsoft/layoutlmv3-base/resolve/main/config.json',
}




class 							snake_case							(			__UpperCAmelCase ):

      '''simple docstring'''



      _A     :       Optional[Any]         =       'layoutlmv3'

      def __init__(							self       :      List[str]						,				__lowercase       :      int=50_265						,				__lowercase       :      Union[str, Any]=768						,				__lowercase       :      List[str]=12						,				__lowercase       :      Optional[Any]=12						,				__lowercase       :      int=3_072						,				__lowercase       :      List[str]="gelu"						,				__lowercase       :      Optional[Any]=0.1						,				__lowercase       :      Any=0.1						,				__lowercase       :      Any=512						,				__lowercase       :      Any=2						,				__lowercase       :      str=0.0_2						,				__lowercase       :      List[str]=1e-5						,				__lowercase       :      Tuple=1						,				__lowercase       :      Tuple=0						,				__lowercase       :      int=2						,				__lowercase       :      Tuple=1_024						,				__lowercase       :      Any=128						,				__lowercase       :      Tuple=128						,				__lowercase       :      List[Any]=True						,				__lowercase       :      str=32						,				__lowercase       :      Union[str, Any]=128						,				__lowercase       :      Dict=64						,				__lowercase       :      Union[str, Any]=256						,				__lowercase       :      Tuple=True						,				__lowercase       :      Optional[int]=True						,				__lowercase       :      Optional[Any]=True						,				__lowercase       :      List[str]=224						,				__lowercase       :      Optional[int]=3						,				__lowercase       :      str=16						,				__lowercase       :      int=None						,				**__lowercase       :      List[Any]						,				):


        '''simple docstring'''




        super().__init__(
            vocab_size=__lowercase						,				hidden_size=__lowercase						,				num_hidden_layers=__lowercase						,				num_attention_heads=__lowercase						,				intermediate_size=__lowercase						,				hidden_act=__lowercase						,				hidden_dropout_prob=__lowercase						,				attention_probs_dropout_prob=__lowercase						,				max_position_embeddings=__lowercase						,				type_vocab_size=__lowercase						,				initializer_range=__lowercase						,				layer_norm_eps=__lowercase						,				pad_token_id=__lowercase						,				bos_token_id=__lowercase						,				eos_token_id=__lowercase						,				**__lowercase						,				)
        __UpperCAmelCase    :						Optional[Any]       =						max_ad_position_embeddings
        __UpperCAmelCase    :						str       =						coordinate_size
        __UpperCAmelCase    :						Union[str, Any]       =						shape_size
        __UpperCAmelCase    :						Tuple       =						has_relative_attention_bias
        __UpperCAmelCase    :						List[str]       =						rel_pos_bins
        __UpperCAmelCase    :						List[Any]       =						max_rel_pos
        __UpperCAmelCase    :						Union[str, Any]       =						has_spatial_attention_bias
        __UpperCAmelCase    :						Dict       =						rel_ad_pos_bins
        __UpperCAmelCase    :						Optional[Any]       =						max_rel_ad_pos
        __UpperCAmelCase    :						Dict       =						text_embed
        __UpperCAmelCase    :						str       =						visual_embed
        __UpperCAmelCase    :						Dict       =						input_size
        __UpperCAmelCase    :						Union[str, Any]       =						num_channels
        __UpperCAmelCase    :						Union[str, Any]       =						patch_size
        __UpperCAmelCase    :						List[str]       =						classifier_dropout




class 							snake_case							(			__UpperCAmelCase ):

      '''simple docstring'''



      _A     :       Dict         =       version.parse('1.12' )

      @property
      def       A_					(							self       :      Optional[Any] ):


        '''simple docstring'''




        if self.task in ["question-answering", "sequence-classification"]:
          return OrderedDict(
              [
                  ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
                  ('''attention_mask''', {0: '''batch''', 1: '''sequence'''}),
                  ('''bbox''', {0: '''batch''', 1: '''sequence'''}),
                  ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
              ] )
        else:
          return OrderedDict(
              [
                  ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
                  ('''bbox''', {0: '''batch''', 1: '''sequence'''}),
                  ('''attention_mask''', {0: '''batch''', 1: '''sequence'''}),
                  ('''pixel_values''', {0: '''batch''', 1: '''num_channels'''}),
              ] )

      @property
      def       A_					(							self       :      int ):


        '''simple docstring'''




        return 1e-5

      @property
      def       A_					(							self       :      int ):


        '''simple docstring'''




        return 12







      def       A_					(							self       :      Union[str, Any]						,				__lowercase       :      "ProcessorMixin"						,				__lowercase       :      int = -1						,				__lowercase       :      int = -1						,				__lowercase       :      bool = False						,				__lowercase       :      Optional["TensorType"] = None						,				__lowercase       :      int = 3						,				__lowercase       :      int = 40						,				__lowercase       :      int = 40						,				):


        '''simple docstring'''




        setattr(processor.image_processor						,				'''apply_ocr'''						,				__lowercase )

        # If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
        __UpperCAmelCase    :						str       =						compute_effective_axis_dimension(
            __lowercase						,				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
        __UpperCAmelCase    :						Dict       =						processor.tokenizer.num_special_tokens_to_add(__lowercase )
        __UpperCAmelCase    :						Tuple       =						compute_effective_axis_dimension(
            __lowercase						,				fixed_dimension=OnnxConfig.default_fixed_sequence						,				num_token_to_add=__lowercase )
        # Generate dummy inputs according to compute batch and sequence
        __UpperCAmelCase    :						Optional[int]       =						[[''' '''.join([processor.tokenizer.unk_token] ) * seq_length]] * batch_size

        # Generate dummy bounding boxes
        __UpperCAmelCase    :						Union[str, Any]       =						[[[48, 84, 73, 128]]] * batch_size

        # If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
        # batch_size = compute_effective_axis_dimension(batch_size, fixed_dimension=OnnxConfig.default_fixed_batch)
        __UpperCAmelCase    :						Union[str, Any]       =						self._generate_dummy_images(__lowercase						,				__lowercase						,				__lowercase						,				__lowercase )

        __UpperCAmelCase    :						Tuple       =						dict(
            processor(
                __lowercase						,				text=__lowercase						,				boxes=__lowercase						,				return_tensors=__lowercase						,				) )

        return inputs






"""simple docstring"""





def       lowerCamelCase_       (   )						->str:





  """simple docstring"""


  for n in range(1  ,			1_00_00_00  ):
    yield n * (n + 1) // 2


def       lowerCamelCase_       (   UpperCAmelCase_  )						->Union[str, Any]:





  """simple docstring"""


  __UpperCAmelCase    :						Dict       =						1
  __UpperCAmelCase    :						Any       =						2
  while i * i <= n:
    __UpperCAmelCase    :						Tuple       =						0
    while n % i == 0:
      n //= i
      multiplicity += 1
    divisors_count *= multiplicity + 1
    i += 1
  if n > 1:
    divisors_count *= 2
  return divisors_count


def       lowerCamelCase_       (   )						->Optional[int]:





  """simple docstring"""


  return next(i for i in triangle_number_generator() if count_divisors(UpperCAmelCase_  ) > 5_00  )


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