


from ...configuration_utils import PretrainedConfig
from ...utils import logging


_snake_case  :	Any			      =       logging.get_logger(__name__)

_snake_case  :	Optional[int]			      =       {
    "facebook/timesformer": "https://huggingface.co/facebook/timesformer/resolve/main/config.json",
}

class        a	(_lowerCAmelCase   ):




							"""simple docstring"""


							__UpperCAmelCase  						=						"timesformer"

							def __init__(							self :						Union[str, Any]					,			lowerCamelCase :						Union[str, Any]=224					,			lowerCamelCase :						Tuple=16					,			lowerCamelCase :						Tuple=3					,			lowerCamelCase :						Optional[int]=8					,			lowerCamelCase :						str=768					,			lowerCamelCase :						Union[str, Any]=12					,			lowerCamelCase :						Optional[Any]=12					,			lowerCamelCase :						str=3072					,			lowerCamelCase :						Dict="gelu"					,			lowerCamelCase :						Dict=0.0					,			lowerCamelCase :						Optional[int]=0.0					,			lowerCamelCase :						List[Any]=0.02					,			lowerCamelCase :						Union[str, Any]=1E-6					,			lowerCamelCase :						str=True					,			lowerCamelCase :						List[str]="divided_space_time"					,			lowerCamelCase :						Union[str, Any]=0					,			**lowerCamelCase :						Optional[Any]					,			)			->					Optional[int]:
														super().__init__(**lowerCamelCase       )

														__snake_case	:    str											=     image_size
														__snake_case	:    List[str]											=     patch_size
														__snake_case	:    str											=     num_channels
														__snake_case	:    int											=     num_frames

														__snake_case	:    Tuple											=     hidden_size
														__snake_case	:    Any											=     num_hidden_layers
														__snake_case	:    Tuple											=     num_attention_heads
														__snake_case	:    Optional[int]											=     intermediate_size
														__snake_case	:    Optional[Any]											=     hidden_act
														__snake_case	:    Any											=     hidden_dropout_prob
														__snake_case	:    List[Any]											=     attention_probs_dropout_prob
														__snake_case	:    Optional[int]											=     initializer_range
														__snake_case	:    Optional[Any]											=     layer_norm_eps
														__snake_case	:    Any											=     qkv_bias

														__snake_case	:    Dict											=     attention_type
														__snake_case	:    str											=     drop_path_rate





import unittest

import numpy as np







def        lowerCAmelCase_  (      __lowerCamelCase							,			__lowerCamelCase							,			__lowerCamelCase							,			__lowerCamelCase = None							,			):
							__snake_case	:    List[str]											=     np.shape(__lowerCamelCase			)
							__snake_case	:    Optional[Any]											=     np.shape(__lowerCamelCase			)
							__snake_case	:    List[str]											=     np.shape(__lowerCamelCase			)

							if shape_a[0] != shape_b[0]:
														__snake_case	:    Any											=     (
														    "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(__lowerCamelCase			)

							if shape_b[1] != shape_c[1]:
														__snake_case	:    int											=     (
														    "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(__lowerCamelCase			)

							__snake_case	:    str											=     pseudo_inv
							if a_inv is None:
														try:
																					__snake_case	:    Optional[Any]											=     np.linalg.inv(__lowerCamelCase			)
														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   ):




							"""simple docstring"""


							def 					__snake_case      (							self :						Tuple       )			->					None:
														__snake_case	:    str											=     np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]       )
														__snake_case	:    str											=     np.array([[0, 3], [3, 0], [2, 3]]       )
														__snake_case	:    Dict											=     np.array([[2, 1], [6, 3]]       )

														__snake_case	:    Dict											=     schur_complement(lowerCamelCase					,			lowerCamelCase					,			lowerCamelCase       )

														__snake_case	:    int											=     np.block([[a, b], [b.T, c]]       )

														__snake_case	:    Optional[int]											=     np.linalg.det(lowerCamelCase       )
														__snake_case	:    Any											=     np.linalg.det(lowerCamelCase       )
														__snake_case	:    Tuple											=     np.linalg.det(lowerCamelCase       )

														self.assertAlmostEqual(lowerCamelCase					,			det_a * det_s       )

							def 					__snake_case      (							self :						int       )			->					None:
														__snake_case	:    str											=     np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]       )
														__snake_case	:    Dict											=     np.array([[0, 3], [3, 0], [2, 3]]       )
														__snake_case	:    Tuple											=     np.array([[2, 1], [6, 3]]       )

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






							def 					__snake_case      (							self :						List[Any]       )			->					None:
														__snake_case	:    List[Any]											=     np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]       )
														__snake_case	:    Tuple											=     np.array([[0, 3], [3, 0], [2, 3]]       )
														__snake_case	:    List[Any]											=     np.array([[2, 1, 3], [6, 3, 5]]       )

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


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			unittest.main()

