





"""simple docstring"""





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


lowerCAmelCase__   	=	logging.get_logger(__name__)

lowerCAmelCase__   	=	{
    '''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 				_lowerCamelCase					(				UpperCAmelCase_     ,	UpperCAmelCase_       ):
						UpperCAmelCase_       =	'nat'

						UpperCAmelCase_       =	{
						    'num_attention_heads': 'num_heads',
						    'num_hidden_layers': 'num_layers',
						}


						def __init__(self      ,							__a=4      ,							__a=3      ,							__a=64      ,							__a=[3, 4, 6, 5]      ,							__a=[2, 4, 8, 16]      ,							__a=7      ,							__a=3.0      ,							__a=True      ,							__a=0.0      ,							__a=0.0      ,							__a=0.1      ,							__a="gelu"      ,							__a=0.02      ,							__a=1e-5      ,							__a=0.0      ,							__a=None      ,							__a=None      ,							**__a      ,							)       ->      Union[str, Any]:
								super().__init__(**__UpperCAmelCase						)

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







import math
import random




def    lowerCAmelCase_ (     __A,  __A = False							)     ->				float:







      '''simple docstring'''


      if deriv:
            return value * (1 - value)
      return 1 / (1 + math.exp(-value							))


# Initial Value
UpperCamelCase__											=					0.0_2




def    lowerCAmelCase_ (     __A,  __A							)     ->				float:







      '''simple docstring'''


      UpperCAmelCase__								=  float(2 * (random.randint(1,  100							)) - 1							)

      for _ in range(__A							):
            # Forward propagation
            UpperCAmelCase__								=  sigmoid_function(INITIAL_VALUE * weight							)
            # How much did we miss?
            UpperCAmelCase__								=  (expected / 100) - layer_a
            # Error delta
            UpperCAmelCase__								=  layer_1_error * sigmoid_function(__A,  __A							)
            # Update weight
            weight += INITIAL_VALUE * layer_1_delta

      return layer_a * 100


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      UpperCamelCase__											=					int(input('Expected value: '))
      UpperCamelCase__											=					int(input('Number of propagations: '))
      print(forward_propagation(expected, number_propagations))



