import timeit



class    lowercase_    :



							def __init__(						self      ,				lowercase_				):
													if isinstance(lowercase_      ,				lowercase_				):  # Initializes a matrix identical to the one provided.
																			_snake_case						:     int				=    arg
																			_snake_case						:     Union[str, Any]				=    len(lowercase_				)
													else:  # Initializes a square matrix of the given size and set values to zero.
																			_snake_case						:     Dict				=    arg
																			_snake_case						:     Optional[Any]				=    [[0 for _ in range(self.n				)] for _ in range(self.n				)]



							def __mul__(						self      ,				lowercase_				):
													_snake_case						:     Tuple				=    Matrix(self.n				)
													for i in range(self.n				):
																			for j in range(self.n				):
																									for k in range(self.n				):
																															matrix.t[i][j] += self.t[i][k] * b.t[k][j]
													return matrix




def 					snake_case						(__lowercase					,			__lowercase						)       ->       Tuple:

						'''simple docstring'''



						_snake_case						:     Any				=    Matrix([[1, 0], [0, 1]]						)
						while b > 0:
												if b & 1:
																		matrix *= a
												a *= a
												b >>= 1
						return matrix
def 					snake_case						(__lowercase					,			__lowercase					,			__lowercase						)       ->       Any:

						'''simple docstring'''



						if n == 1:
												return fa
						elif n == 2:
												return fa
						_snake_case						:     List[str]				=    Matrix([[1, 1], [1, 0]]						)
						_snake_case						:     List[str]				=    modular_exponentiation(__lowercase					,			n - 2						)
						return fa * matrix.t[0][0] + fa * matrix.t[0][1]
def 					snake_case						(__lowercase					,			__lowercase					,			__lowercase						)       ->       Union[str, Any]:

						'''simple docstring'''



						if n == 1:
												return fa
						elif n == 2:
												return fa

						_snake_case						:     Union[str, Any]				=    fa
						_snake_case						:     Optional[int]				=    fa
						n -= 2

						while n > 0:
												_snake_case				,_snake_case						:     Tuple				=    fn_a + fn_a, fn_a
												n -= 1

						return fn_a
def 					snake_case						()       ->       List[str]:

						'''simple docstring'''



						_snake_case						:     List[str]				=    "\nfrom random import randint\nfrom __main__ import fibonacci_with_matrix_exponentiation\n"
						_snake_case						:     Optional[Any]				=    "fibonacci_with_matrix_exponentiation(randint(1,70000), 1, 1)"
						_snake_case						:     str				=    timeit.timeit(setup=__lowercase					,			stmt=__lowercase					,			number=100						)
						print("With matrix exponentiation the average execution time is "					,			exec_time / 100						)
						return exec_time
def 					snake_case						()       ->       Optional[int]:

						'''simple docstring'''



						_snake_case						:     int				=    "\nfrom random import randint\nfrom __main__ import simple_fibonacci\n"
						_snake_case						:     Any				=    "simple_fibonacci(randint(1,70000), 1, 1)"
						_snake_case						:     List[str]				=    timeit.timeit(setup=__lowercase					,			stmt=__lowercase					,			number=100						)
						print(
						    "Without matrix exponentiation the average execution time is "					,			exec_time / 100						)
						return exec_time
def 					snake_case						()       ->       int:

						'''simple docstring'''



						matrix_exponentiation_time()
						simple_fibonacci_time()


if __name__ == "__main__":
				main()
from collections import OrderedDict
from typing import Mapping

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


__SCREAMING_SNAKE_CASE						:    str     = logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE						:    Union[str, Any]     = {
    'nghuyong/ernie-1.0-base-zh': 'https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json',
    'nghuyong/ernie-2.0-base-en': 'https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json',
    'nghuyong/ernie-2.0-large-en': 'https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json',
    'nghuyong/ernie-3.0-base-zh': 'https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-medium-zh': 'https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-mini-zh': 'https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-micro-zh': 'https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-nano-zh': 'https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json',
    'nghuyong/ernie-gram-zh': 'https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json',
    'nghuyong/ernie-health-zh': 'https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json',
}



class    lowercase_    (     __snake_case		):
							_lowerCamelCase						=		'ernie'



							def __init__(						self      ,				lowercase_=30_522      ,				lowercase_=768      ,				lowercase_=12      ,				lowercase_=12      ,				lowercase_=3_072      ,				lowercase_="gelu"      ,				lowercase_=0.1      ,				lowercase_=0.1      ,				lowercase_=512      ,				lowercase_=2      ,				lowercase_=3      ,				lowercase_=False      ,				lowercase_=0.02      ,				lowercase_=1e-12      ,				lowercase_=0      ,				lowercase_="absolute"      ,				lowercase_=True      ,				lowercase_=None      ,				**lowercase_      ,				):
													super().__init__(pad_token_id=lowercase_      ,				**lowercase_				)

													_snake_case						:     List[Any]				=    vocab_size
													_snake_case						:     Dict				=    hidden_size
													_snake_case						:     Any				=    num_hidden_layers
													_snake_case						:     List[str]				=    num_attention_heads
													_snake_case						:     int				=    hidden_act
													_snake_case						:     Tuple				=    intermediate_size
													_snake_case						:     Tuple				=    hidden_dropout_prob
													_snake_case						:     Optional[int]				=    attention_probs_dropout_prob
													_snake_case						:     Any				=    max_position_embeddings
													_snake_case						:     List[str]				=    type_vocab_size
													_snake_case						:     List[Any]				=    task_type_vocab_size
													_snake_case						:     Optional[int]				=    use_task_id
													_snake_case						:     Tuple				=    initializer_range
													_snake_case						:     Union[str, Any]				=    layer_norm_eps
													_snake_case						:     Optional[Any]				=    position_embedding_type
													_snake_case						:     int				=    use_cache
													_snake_case						:     Optional[Any]				=    classifier_dropout




class    lowercase_    (     __snake_case		):



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