
    g                         d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ  ej        e          Z G d	 d
e	          Z G d de          ZdS )z EfficientNet model configuration    OrderedDict)ListMapping)version   )PretrainedConfig)
OnnxConfig)loggingc            +           e Zd ZdZdZdddddg dg d	g d
g g dg dg ddddddddddfdedededededee         dee         dee         dee         d ee         d!ee         d"ee         d#ed$ed%ed&ed'ed(ed)ed*ed+ef* fd,Z	 xZ
S )-EfficientNetConfiga#  
    This is the configuration class to store the configuration of a [`EfficientNetModel`]. It is used to instantiate an
    EfficientNet model according to the specified arguments, defining the model architecture. Instantiating a
    configuration with the defaults will yield a similar configuration to that of the EfficientNet
    [google/efficientnet-b7](https://huggingface.co/google/efficientnet-b7) architecture.

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        num_channels (`int`, *optional*, defaults to 3):
            The number of input channels.
        image_size (`int`, *optional*, defaults to 600):
            The input image size.
        width_coefficient (`float`, *optional*, defaults to 2.0):
            Scaling coefficient for network width at each stage.
        depth_coefficient (`float`, *optional*, defaults to 3.1):
            Scaling coefficient for network depth at each stage.
        depth_divisor `int`, *optional*, defaults to 8):
            A unit of network width.
        kernel_sizes (`List[int]`, *optional*, defaults to `[3, 3, 5, 3, 5, 5, 3]`):
            List of kernel sizes to be used in each block.
        in_channels (`List[int]`, *optional*, defaults to `[32, 16, 24, 40, 80, 112, 192]`):
            List of input channel sizes to be used in each block for convolutional layers.
        out_channels (`List[int]`, *optional*, defaults to `[16, 24, 40, 80, 112, 192, 320]`):
            List of output channel sizes to be used in each block for convolutional layers.
        depthwise_padding (`List[int]`, *optional*, defaults to `[]`):
            List of block indices with square padding.
        strides (`List[int]`, *optional*, defaults to `[1, 2, 2, 2, 1, 2, 1]`):
            List of stride sizes to be used in each block for convolutional layers.
        num_block_repeats (`List[int]`, *optional*, defaults to `[1, 2, 2, 3, 3, 4, 1]`):
            List of the number of times each block is to repeated.
        expand_ratios (`List[int]`, *optional*, defaults to `[1, 6, 6, 6, 6, 6, 6]`):
            List of scaling coefficient of each block.
        squeeze_expansion_ratio (`float`, *optional*, defaults to 0.25):
            Squeeze expansion ratio.
        hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
            The non-linear activation function (function or string) in each block. If string, `"gelu"`, `"relu"`,
            `"selu", `"gelu_new"`, `"silu"` and `"mish"` are supported.
        hiddem_dim (`int`, *optional*, defaults to 1280):
            The hidden dimension of the layer before the classification head.
        pooling_type (`str` or `function`, *optional*, defaults to `"mean"`):
            Type of final pooling to be applied before the dense classification head. Available options are [`"mean"`,
            `"max"`]
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        batch_norm_eps (`float`, *optional*, defaults to 1e-3):
            The epsilon used by the batch normalization layers.
        batch_norm_momentum (`float`, *optional*, defaults to 0.99):
            The momentum used by the batch normalization layers.
        dropout_rate (`float`, *optional*, defaults to 0.5):
            The dropout rate to be applied before final classifier layer.
        drop_connect_rate (`float`, *optional*, defaults to 0.2):
            The drop rate for skip connections.

    Example:
    ```python
    >>> from transformers import EfficientNetConfig, EfficientNetModel

    >>> # Initializing a EfficientNet efficientnet-b7 style configuration
    >>> configuration = EfficientNetConfig()

    >>> # Initializing a model (with random weights) from the efficientnet-b7 style configuration
    >>> model = EfficientNetModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```efficientnetr   iX  g       @g@   )r   r      r   r   r   r   )          (   P   p      )r   r   r   r   r   r   i@  )      r   r   r   r   r   )r   r   r   r   r      r   )r      r   r   r   r   r   g      ?swishi 
  meang{Gz?gMbP?gGz?g      ?g?num_channels
image_sizewidth_coefficientdepth_coefficientdepth_divisorkernel_sizesin_channelsout_channelsdepthwise_paddingstridesnum_block_repeatsexpand_ratiossqueeze_expansion_ratio
hidden_act
hidden_dimpooling_typeinitializer_rangebatch_norm_epsbatch_norm_momentumdropout_ratedrop_connect_ratec                     t                      j        di | || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        t/          |          dz  | _        d S )Nr    )super__init__r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   sumnum_hidden_layers)selfr   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   kwargs	__class__s                          w/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/models/efficientnet/configuration_efficientnet.pyr6   zEfficientNetConfig.__init__f   s    2 	""6"""($!2!2*(&(!2!2*'>$$$(!2,#6 (!2!$%6!7!7!!;    )__name__
__module____qualname____doc__
model_typeintfloatr   strr6   __classcell__)r;   s   @r<   r   r      s       C CJ  J #&#&"7"7"7!?!?!?"A"A"A')222'<'<'<#8#8#8)-!"#' %%)!#&-0< 0<0< 0< !	0<
 !0< 0< 3i0< #Y0< 3i0<  90< c0<  90< Cy0< "'0< 0<  !0<" #0<$ !%0<& '0<( #)0<* +0<, !-0< 0< 0< 0< 0< 0< 0< 0< 0< 0<r=   r   c                       e Zd Z ej        d          Zedeeee	ef         f         fd            Z
edefd            ZdS )EfficientNetOnnxConfigz1.11returnc                 0    t          ddddddfg          S )Npixel_valuesbatchr   heightwidth)r   r   r   r   r   r9   s    r<   inputszEfficientNetOnnxConfig.inputs   s.    WHQX!Y!YZ
 
 	
r=   c                     dS )Ngh㈵>r4   rO   s    r<   atol_for_validationz*EfficientNetOnnxConfig.atol_for_validation   s    tr=   N)r>   r?   r@   r   parsetorch_onnx_minimum_versionpropertyr   rE   rC   rP   rD   rR   r4   r=   r<   rH   rH      s        !.v!6!6
WS#X%6 67 
 
 
 X
 U    X  r=   rH   N)rA   collectionsr   typingr   r   	packagingr   configuration_utilsr	   onnxr
   utilsr   
get_loggerr>   loggerr   rH   r4   r=   r<   <module>r^      s    ' & # # # # # #                       3 3 3 3 3 3             
	H	%	%x< x< x< x< x<) x< x< x<v    Z     r=   