'''simple docstring'''




import math

import tensorflow as tf
from packaging import version

def _lowercase	(      lowerCamelCase__						)					->       str:





       """simple docstring"""


       __UpperCAmelCase  :				Dict       				=		tf.convert_to_tensor(lowerCamelCase__						)
       __UpperCAmelCase  :				Dict       				=		0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0						)							,    x.dtype						)						))

       return x * cdf

def _lowercase	(      lowerCamelCase__						)					->       Union[str, Any]:





       """simple docstring"""


       __UpperCAmelCase  :				Union[str, Any]       				=		tf.convert_to_tensor(lowerCamelCase__						)
       __UpperCAmelCase  :				List[str]       				=		tf.cast(math.pi							,    x.dtype						)
       __UpperCAmelCase  :				List[str]       				=		tf.cast(0.04_4715							,    x.dtype						)
       __UpperCAmelCase  :				Dict       				=		0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi						) * (x + coeff * tf.pow(lowerCamelCase__							,    3						))						))

       return x * cdf

def _lowercase	(      lowerCamelCase__						)					->       Union[str, Any]:





       """simple docstring"""


       __UpperCAmelCase  :				List[Any]       				=		tf.convert_to_tensor(lowerCamelCase__						)

       return x * tf.tanh(tf.math.softplus(lowerCamelCase__						)						)

def _lowercase	(      lowerCamelCase__						)					->       str:





       """simple docstring"""


       __UpperCAmelCase  :				Optional[Any]       				=		tf.convert_to_tensor(lowerCamelCase__						)
       __UpperCAmelCase  :				int       				=		tf.cast(0.04_4715							,    x.dtype						)
       __UpperCAmelCase  :				Dict       				=		tf.cast(0.79_7884_5608							,    x.dtype						)

       return 0.5 * x * (1.0 + tf.tanh(x * coeffa * (1.0 + coeffa * x * x)						))

def _lowercase	(      lowerCamelCase__						)					->       List[str]:





       """simple docstring"""


       __UpperCAmelCase  :				Optional[Any]       				=		tf.convert_to_tensor(lowerCamelCase__						)
       __UpperCAmelCase  :				Dict       				=		tf.cast(1.702							,    x.dtype						)
       return x * tf.math.sigmoid(coeff * x						)

def _lowercase	(      lowerCamelCase__						)					->       Union[str, Any]:





       """simple docstring"""


       return tf.clip_by_value(_gelu(lowerCamelCase__						)							,    -10							,    10						)

def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__=-1						)					->       Optional[int]:





       """simple docstring"""


       __UpperCAmelCase				, __UpperCAmelCase  :				str       				=		tf.split(lowerCamelCase__							,    2							,    axis=lowerCamelCase__						)
       return a * tf.math.sigmoid(lowerCamelCase__						)


if version.parse(tf.version.VERSION) >= version.parse("2.4"):

   def _lowercase	(      lowerCamelCase__						)					->       str:





          """simple docstring"""


          return tf.keras.activations.gelu(lowerCamelCase__							,    approximate=lowerCamelCase__						)

   _a   :	Tuple 							=   tf.keras.activations.gelu


   _a   :	Dict 							=   approximate_gelu_wrap
else:
   _a   :	Optional[int] 							=   _gelu
   _a   :	Optional[int] 							=   _gelu_new


_a   :	Union[str, Any] 							=   {
    """gelu""": gelu,
    """gelu_10""": gelu_aa,
    """gelu_fast""": gelu_fast,
    """gelu_new""": gelu_new,
    """glu""": glu,
    """mish""": mish,
    """quick_gelu""": quick_gelu,
    """relu""": tf.keras.activations.relu,
    """sigmoid""": tf.keras.activations.sigmoid,
    """silu""": tf.keras.activations.swish,
    """swish""": tf.keras.activations.swish,
    """tanh""": tf.keras.activations.tanh,
}


def _lowercase	(      lowerCamelCase__						)					->       Optional[Any]:





       """simple docstring"""


       if activation_string in ACTaFN:
              return ACTaFN[activation_string]
       else:
              raise KeyError(f"""function {activation_string} not found in ACT2FN mapping {list(ACTaFN.keys()						)}"""						)







'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

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


_a   :	List[str] 							=   logging.get_logger(__name__)

_a   :	Any 							=   {
    "kssteven/ibert-roberta-base": "https://huggingface.co/kssteven/ibert-roberta-base/resolve/main/config.json",
    "kssteven/ibert-roberta-large": "https://huggingface.co/kssteven/ibert-roberta-large/resolve/main/config.json",
    "kssteven/ibert-roberta-large-mnli": (
        "https://huggingface.co/kssteven/ibert-roberta-large-mnli/resolve/main/config.json"
    ),
}






class 		__A       (__magic_name__   ):
       snake_case       :Union[str, Any]				    =					"ibert"






       def __init__(      self				,     UpperCamelCase_=3_05_22				,     UpperCamelCase_=7_68				,     UpperCamelCase_=12				,     UpperCamelCase_=12				,     UpperCamelCase_=30_72				,     UpperCamelCase_="gelu"				,     UpperCamelCase_=0.1				,     UpperCamelCase_=0.1				,     UpperCamelCase_=5_12				,     UpperCamelCase_=2				,     UpperCamelCase_=0.0_2				,     UpperCamelCase_=1E-12				,     UpperCamelCase_=1				,     UpperCamelCase_=0				,     UpperCamelCase_=2				,     UpperCamelCase_="absolute"				,     UpperCamelCase_=False				,     UpperCamelCase_="none"				,     **UpperCamelCase_				,     ):
              super().__init__(pad_token_id=UpperCamelCase_				,     bos_token_id=UpperCamelCase_				,     eos_token_id=UpperCamelCase_				,     **UpperCamelCase_      )

              __UpperCAmelCase  :				List[Any]       				=		vocab_size
              __UpperCAmelCase  :				Optional[Any]       				=		hidden_size
              __UpperCAmelCase  :				List[Any]       				=		num_hidden_layers
              __UpperCAmelCase  :				Any       				=		num_attention_heads
              __UpperCAmelCase  :				List[str]       				=		hidden_act
              __UpperCAmelCase  :				List[str]       				=		intermediate_size
              __UpperCAmelCase  :				Optional[int]       				=		hidden_dropout_prob
              __UpperCAmelCase  :				Union[str, Any]       				=		attention_probs_dropout_prob
              __UpperCAmelCase  :				str       				=		max_position_embeddings
              __UpperCAmelCase  :				List[str]       				=		type_vocab_size
              __UpperCAmelCase  :				Dict       				=		initializer_range
              __UpperCAmelCase  :				Optional[int]       				=		layer_norm_eps
              __UpperCAmelCase  :				Any       				=		position_embedding_type
              __UpperCAmelCase  :				Tuple       				=		quant_mode
              __UpperCAmelCase  :				Union[str, Any]       				=		force_dequant






class 		__A       (__magic_name__   ):






       @property
       def 			_snake_case						(      self      ):
              if self.task == "multiple-choice":
                     __UpperCAmelCase  :				Optional[int]       				=		{0: "batch", 1: "choice", 2: "sequence"}
              else:
                     __UpperCAmelCase  :				Optional[int]       				=		{0: "batch", 1: "sequence"}
              return OrderedDict(
                  [
                      ("input_ids", dynamic_axis),
                      ("attention_mask", dynamic_axis),
                  ]      )






