


'''simple docstring'''

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


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

a_						:       str      			=				{
    '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   snake_case					(					__lowercase    ,		__lowercase    ):





  """simple docstring"""




  _lowerCamelCase						=						'''nat'''

  _lowerCamelCase						=						{
      '''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__(**__a  )

   lowerCamelCase_  				=						patch_size
   lowerCamelCase_  				=						num_channels
   lowerCamelCase_  				=						embed_dim
   lowerCamelCase_  				=						depths
   lowerCamelCase_  				=						len(__a  )
   lowerCamelCase_  				=						num_heads
   lowerCamelCase_  				=						kernel_size
   lowerCamelCase_  				=						mlp_ratio
   lowerCamelCase_  				=						qkv_bias
   lowerCamelCase_  				=						hidden_dropout_prob
   lowerCamelCase_  				=						attention_probs_dropout_prob
   lowerCamelCase_  				=						drop_path_rate
   lowerCamelCase_  				=						hidden_act
   lowerCamelCase_  				=						layer_norm_eps
   lowerCamelCase_  				=						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
   lowerCamelCase_  				=						int(embed_dim * 2 ** (len(__a  ) - 1)  )
   lowerCamelCase_  				=						layer_scale_init_value
   lowerCamelCase_  				=						["""stem"""] + [f'''stage{idx}''' for idx in range(1    ,						len(__a  ) + 1  )]
   lowerCamelCase_  				=						get_aligned_output_features_output_indices(
       out_features=__a    ,						out_indices=__a    ,						stage_names=self.stage_names  )







'''simple docstring'''

import math





def __snake_case      (   UpperCAmelCase_		:		float      ,       UpperCAmelCase_		:		float	):
 return math.pow(UpperCAmelCase_      ,       2	) - a





def __snake_case      (   UpperCAmelCase_		:		float	):
 return 2 * x





def __snake_case      (   UpperCAmelCase_		:		float	):
 lowerCamelCase_  				=						2.0

 while start <= a:
  lowerCamelCase_  				=						math.pow(UpperCAmelCase_      ,       2	)

 return start





def __snake_case      (   UpperCAmelCase_		:		float      ,       UpperCAmelCase_		:		int = 9999      ,       UpperCAmelCase_		:		float = 0.00_0000_0000_0001	):

 if a < 0:
  raise ValueError("math domain error"	)

 lowerCamelCase_  				=						get_initial_point(UpperCAmelCase_	)

 for _ in range(UpperCAmelCase_	):
  lowerCamelCase_  				=						value
  lowerCamelCase_  				=						value - fx(UpperCAmelCase_      ,       UpperCAmelCase_	) / fx_derivative(UpperCAmelCase_	)
  if abs(prev_value - value	) < tolerance:
   return value

 return value


if __name__ == "__main__":
     from doctest import testmod

     testmod()



