"""simple docstring"""


from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowerCAmelCase_:					int     =					logging.get_logger(__name__)

lowerCAmelCase_:					Tuple     =					{
    "shi-labs/nat-mini-in1k-224": "https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json",
    # See all Nat models at https://huggingface.co/models?filter=nat
}






class    a__    (   _a					,					_a	):
   snake_case_							=      "nat"

   snake_case_							=      {
       "num_attention_heads": "num_heads",
       "num_hidden_layers": "num_layers",
   }


   def __init__(     self,				_UpperCAmelCase=4,				_UpperCAmelCase=3,				_UpperCAmelCase=64,				_UpperCAmelCase=[3, 4, 6, 5],				_UpperCAmelCase=[2, 4, 8, 16],				_UpperCAmelCase=7,				_UpperCAmelCase=3.0,				_UpperCAmelCase=True,				_UpperCAmelCase=0.0,				_UpperCAmelCase=0.0,				_UpperCAmelCase=0.1,				_UpperCAmelCase="gelu",				_UpperCAmelCase=0.02,				_UpperCAmelCase=1E-5,				_UpperCAmelCase=0.0,				_UpperCAmelCase=None,				_UpperCAmelCase=None,				**_UpperCAmelCase,				):
        '''simple docstring'''



        super().__init__(**_UpperCAmelCase  )

        lowercase__				 =							patch_size
        lowercase__				 =							num_channels
        lowercase__				 =							embed_dim
        lowercase__				 =							depths
        lowercase__				 =							len(_UpperCAmelCase  )
        lowercase__				 =							num_heads
        lowercase__				 =							kernel_size
        lowercase__				 =							mlp_ratio
        lowercase__				 =							qkv_bias
        lowercase__				 =							hidden_dropout_prob
        lowercase__				 =							attention_probs_dropout_prob
        lowercase__				 =							drop_path_rate
        lowercase__				 =							hidden_act
        lowercase__				 =							layer_norm_eps
        lowercase__				 =							initializer_range
        # we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
        # this indicates the channel dimension after the last stage of the model
        lowercase__				 =							int(embed_dim * 2 ** (len(_UpperCAmelCase  ) - 1)  )
        lowercase__				 =							layer_scale_init_value
        lowercase__				 =							["stem"] + [F'''stage{idx}''' for idx in range(1,				len(_UpperCAmelCase  ) + 1  )]
        lowercase__ ,						lowercase__				 =							get_aligned_output_features_output_indices(
            out_features=_UpperCAmelCase,				out_indices=_UpperCAmelCase,				stage_names=self.stage_names  )





"""simple docstring"""


from typing import Any

import numpy as np







def 					__a   (		A      ):






     '''simple docstring'''



     return np.array_equal(A    ,				matrix.conjugate().T      )







def 					__a   (		A    ,				A      ):






     '''simple docstring'''



     lowercase__				 =							v.conjugate().T
     lowercase__				 =							v_star.dot(A      )
     assert isinstance(A    ,				np.ndarray      )
     return (v_star_dot.dot(A      )) / (v_star.dot(A      ))







def 					__a   (		):






     '''simple docstring'''



     lowercase__				 =							np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]]      )
     lowercase__				 =							np.array([[1], [2], [3]]      )
     assert is_hermitian(A      ), f'''{a} is not hermitian.'''
     print(rayleigh_quotient(A    ,				A      )      )

     lowercase__				 =							np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]      )
     assert is_hermitian(A      ), f'''{a} is not hermitian.'''
     assert rayleigh_quotient(A    ,				A      ) == float(3      )


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 tests()




