




from ... import PretrainedConfig


a													=			{
    "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json",
}




class       _A				(		__lowercase     ):
		__a					    =       NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP
		__a					    =       """nezha"""






		def __init__(    self						,		_SCREAMING_SNAKE_CASE=2_1128						,		_SCREAMING_SNAKE_CASE=768						,		_SCREAMING_SNAKE_CASE=12						,		_SCREAMING_SNAKE_CASE=12						,		_SCREAMING_SNAKE_CASE=3072						,		_SCREAMING_SNAKE_CASE="gelu"						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=512						,		_SCREAMING_SNAKE_CASE=64						,		_SCREAMING_SNAKE_CASE=2						,		_SCREAMING_SNAKE_CASE=0.02						,		_SCREAMING_SNAKE_CASE=1e-12						,		_SCREAMING_SNAKE_CASE=0.1						,		_SCREAMING_SNAKE_CASE=0						,		_SCREAMING_SNAKE_CASE=2						,		_SCREAMING_SNAKE_CASE=3						,		_SCREAMING_SNAKE_CASE=True						,		**_SCREAMING_SNAKE_CASE						,		):
								super().__init__(pad_token_id=_SCREAMING_SNAKE_CASE						,		bos_token_id=_SCREAMING_SNAKE_CASE						,		eos_token_id=_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)

								_UpperCAmelCase      =			vocab_size
								_UpperCAmelCase      =			hidden_size
								_UpperCAmelCase      =			num_hidden_layers
								_UpperCAmelCase      =			num_attention_heads
								_UpperCAmelCase      =			hidden_act
								_UpperCAmelCase      =			intermediate_size
								_UpperCAmelCase      =			hidden_dropout_prob
								_UpperCAmelCase      =			attention_probs_dropout_prob
								_UpperCAmelCase      =			max_position_embeddings
								_UpperCAmelCase      =			max_relative_position
								_UpperCAmelCase      =			type_vocab_size
								_UpperCAmelCase      =			initializer_range
								_UpperCAmelCase      =			layer_norm_eps
								_UpperCAmelCase      =			classifier_dropout
								_UpperCAmelCase      =			use_cache





import unittest

import numpy as np




def        _SCREAMING_SNAKE_CASE      (		snake_case			,     snake_case			,     snake_case			,     snake_case = None			,     )						->				np.ndarray:
						_UpperCAmelCase      =			np.shape(snake_case       )
						_UpperCAmelCase      =			np.shape(snake_case       )
						_UpperCAmelCase      =			np.shape(snake_case       )

						if shape_a[0] != shape_b[0]:
												_UpperCAmelCase      =			(
												    """Expected the same number of rows for A and B. """
												    f"Instead found A of size {shape_a} and B of size {shape_b}"
												)
												raise ValueError(snake_case       )

						if shape_b[1] != shape_c[1]:
												_UpperCAmelCase      =			(
												    """Expected the same number of columns for B and C. """
												    f"Instead found B of size {shape_b} and C of size {shape_c}"
												)
												raise ValueError(snake_case       )

						_UpperCAmelCase      =			pseudo_inv
						if a_inv is None:
												try:
																		_UpperCAmelCase      =			np.linalg.inv(snake_case       )
												except np.linalg.LinAlgError:
																		raise ValueError(
																		    """Input matrix A is not invertible. Cannot compute Schur complement."""       )

						return mat_c - mat_b.T @ a_inv @ mat_b




class       _A				(		unittest.TestCase     ):






		def 				UpperCAmelCase (    self			):
								_UpperCAmelCase      =			np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]			)
								_UpperCAmelCase      =			np.array([[0, 3], [3, 0], [2, 3]]			)
								_UpperCAmelCase      =			np.array([[2, 1], [6, 3]]			)

								_UpperCAmelCase      =			schur_complement(_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE			)

								_UpperCAmelCase      =			np.block([[a, b], [b.T, c]]			)

								_UpperCAmelCase      =			np.linalg.det(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			np.linalg.det(_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			np.linalg.det(_SCREAMING_SNAKE_CASE			)

								self.assertAlmostEqual(_SCREAMING_SNAKE_CASE						,		det_a * det_s			)






		def 				UpperCAmelCase (    self			):
								_UpperCAmelCase      =			np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]			)
								_UpperCAmelCase      =			np.array([[0, 3], [3, 0], [2, 3]]			)
								_UpperCAmelCase      =			np.array([[2, 1], [6, 3]]			)

								with self.assertRaises(_SCREAMING_SNAKE_CASE			):
														schur_complement(_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE			)






		def 				UpperCAmelCase (    self			):
								_UpperCAmelCase      =			np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]			)
								_UpperCAmelCase      =			np.array([[0, 3], [3, 0], [2, 3]]			)
								_UpperCAmelCase      =			np.array([[2, 1, 3], [6, 3, 5]]			)

								with self.assertRaises(_SCREAMING_SNAKE_CASE			):
														schur_complement(_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE			)


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				unittest.main()