Ë
    þÍ:js	  ã                   óŽ   — d dl Z d dlmc mZ ddlmZ 	 	 	 dde j                  de j                  dedede	d	e j                  fd
„Z
y)é    Né   )Ú_log_api_usage_onceÚinputsÚtargetsÚalphaÚgammaÚ	reductionÚreturnc                 ó,  — d|cxk  rdk  sn |dk7  rt        d|› d�«      ‚t        j                  j                  «       s-t        j                  j	                  «       st        t        «       t        j                  | «      }t        j                  | |d¬«      }||z  d|z
  d|z
  z  z   }|d|z
  |z  z  }|dk\  r||z  d|z
  d|z
  z  z   }	|	|z  }|dk(  r	 |S |dk(  r|j                  «       }|S |d	k(  r|j                  «       }|S t        d
|› d�«      ‚)a  
    Loss used in RetinaNet for dense detection: https://arxiv.org/abs/1708.02002.

    Args:
        inputs (Tensor): A float tensor of arbitrary shape.
                The predictions for each example.
        targets (Tensor): A float tensor with the same shape as inputs. Stores the binary
                classification label for each element in inputs
                (0 for the negative class and 1 for the positive class).
        alpha (float): Weighting factor in range [0, 1] to balance
                positive vs negative examples or -1 for ignore. Default: ``0.25``.
        gamma (float): Exponent of the modulating factor (1 - p_t) to
                balance easy vs hard examples. Default: ``2``.
        reduction (string): ``'none'`` | ``'mean'`` | ``'sum'``
                ``'none'``: No reduction will be applied to the output.
                ``'mean'``: The output will be averaged.
                ``'sum'``: The output will be summed. Default: ``'none'``.
    Returns:
        Loss tensor with the reduction option applied.
    r   é   éÿÿÿÿzInvalid alpha value: z4. alpha must be in the range [0,1] or -1 for ignore.Únone)r	   ÚmeanÚsumz$Invalid Value for arg 'reduction': 'z3 
 Supported reduction modes: 'none', 'mean', 'sum')Ú
ValueErrorÚtorchÚjitÚis_scriptingÚ
is_tracingr   Úsigmoid_focal_lossÚsigmoidÚFÚ binary_cross_entropy_with_logitsr   r   )
r   r   r   r   r	   ÚpÚce_lossÚp_tÚlossÚalpha_ts
             úo/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/torchvision/ops/focal_loss.pyr   r      s6  € ð: �ŒO˜!ŒO ¨"¢ÜÐ0°°Ð7kÐlÓmÐmä�9‰9×!Ñ!Ô#¬E¯I©I×,@Ñ,@Ô,BÜÔ.Ô/Ü�‰�fÓ€AÜ×0Ñ0°¸ÈFÔS€GØ
ˆg‰+˜˜Q™ 1 w¡;Ñ/Ñ
/€CØ�q˜3‘w 5Ñ(Ñ)€Dà�‚zØ˜'‘/ Q¨¡Y°1°w±;Ñ$?Ñ?ˆØ˜‰~ˆð �FÒØð €Kð 
�fÒ	Ø�y‰y‹{ˆð €Kð 
�eÒ	Ø�x‰x‹zˆð
 €Kô Ø2°9°+Ð=qÐró
ð 	
ó    )g      Ð?r   r   )r   Útorch.nn.functionalÚnnÚ
functionalr   Úutilsr   ÚTensorÚfloatÚstrr   © r    r   ú<module>r)      se   ðÛ ß Ð å 'ð ØØñ6Ø�L‰Lð6à�\‰\ð6ð ð6ð ð	6ð
 ð6ð ‡\�\ô6r    