§
    l¬¸jç  ã                   óZ   — d dl mZ d„ Zd„ Zd„ Z	 ddededed	ed
edefd„Zd„ Z	d„ Z
d„ ZdS )é    )ÚUninitializedParameterc                 ó   — d}| D ]}||z  }Œ|S )z6Compute the product of all elements in the input list.é   © )Úin_listÚresÚ_s      úe/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/thop/vision/calc_func.pyÚl_prodr      s&   € à
€CØð ð ˆØˆq‰ˆˆØ€Jó    c                 ó4   — t          d„ | D ¦   «         ¦  «        S )zdSum the element counts of an iterable of parameters, skipping any a lazy module has not created yet.c              3   óh   K  — | ]-}t          |t          ¦  «        °|                     ¦   «         V — Œ.d S )N)Ú
isinstancer   Únelement)Ú.0Úps     r
   ú	<genexpr>z'calculate_parameters.<locals>.<genexpr>   s:   è è € Ð]Ð] µzÀ!ÕE[Ñ7\Ô7\Ð]ˆq�zŠz‰|Œ|Ð]Ð]Ð]Ð]Ð]Ð]r   )Úsum)Ú
param_lists    r
   Úcalculate_parametersr      s!   € õ
 Ð]Ð] ZÐ]Ñ]Ô]Ñ]Ô]Ð]r   c                  ó   — dS )z Return the zero operation count.r   r   r   r   r
   Úcalculate_zero_opsr      s   € àˆ1r   FÚ
input_sizeÚoutput_sizeÚkernel_sizeÚgroupsÚbiasÚ	transposec                 ó¤   — |r| |fn|| f\  }}t          |¦  «        |t          |¦  «        dz
            |z  z  t          |dd…         ¦  «        z  S )zdCalculate FLOPs for a ConvNd layer using input/output sizes, kernel size, groups, and the bias flag.r   é   N)r   Úlen)r   r   r   r   r   r   ÚvolumeÚchannelss           r
   Úcalculate_conv2d_flopsr$      sh   € ð
 5>Ð\˜
 KÐ0Ð0ÀKÐQ[ÐC\Ñ€FˆHå�&‰>Œ>˜X­¨KÑ(8Ô(8¸1Ñ(<Ð&=Ô>À&ÑHÑIÍFÐS^Ð_`Ð_aÐ_aÔSbÑLcÔLcÑcÐcr   c                 ó   — d| z  S )zACompute the L2 norm of a tensor or array based on its input size.r    r   )r   s    r
   Úcalculate_normr&   %   s   € àˆz‰>Ðr   c                 ód   — |}t          |dz
  d¦  «        }|}| ||z   |z   z  }t          |¦  «        S )zJCompute FLOPs for a softmax activation given batch size and feature count.r   r   )ÚmaxÚint)Ú
batch_sizeÚ	nfeaturesÚ	total_expÚ	total_addÚ	total_divÚ	total_opss         r
   Úcalculate_softmaxr0   *   s?   € à€IÝ�I ‘M 1Ñ%Ô%€IØ€IØ˜i¨)Ñ3°iÑ?Ñ@€IÝˆy‰>Œ>Ðr   c                 ó&   — t          | |z  ¦  «        S )zTCalculate the linear operation count for given input feature and number of elements.)r)   )Ú
in_featureÚnum_elementss     r
   Úcalculate_linearr4   3   s   € åˆz˜LÑ(Ñ)Ô)Ð)r   N)FF)Útorch.nn.parameterr   r   r   r   Úlistr)   Úboolr$   r&   r0   r4   r   r   r
   ú<module>r8      sÛ   ðð 6Ð 5Ð 5Ð 5Ð 5Ð 5ðð ð ð^ð ^ð ^ðð ð ð puðdð dØðdØ#'ðdØ6:ðdØDGðdØOSðdØhlðdð dð dð dðð ð ð
ð ð ð*ð *ð *ð *ð *r   