
    hs	                         S SK r S SKJs  Jr  SSKJr     SS\ R                  S\ R                  S\S\S\	S	\ R                  4S
 jjr
g)    N   )_log_api_usage_onceinputstargetsalphagamma	reductionreturnc                 D   SUs=::  a  S::  d  O  US:w  a  [        SU S35      e[        R                  R                  5       (       d2  [        R                  R	                  5       (       d  [        [        5        [        R                  " U 5      n[        R                  " XSS9nXQ-  SU-
  SU-
  -  -   nUSU-
  U-  -  nUS:  a  X!-  SU-
  SU-
  -  -   n	X-  nUS:X  a   U$ US:X  a  UR                  5       nU$ US	:X  a  UR                  5       nU$ [        S
U S35      e)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
             R/var/www/auris/envauris/lib/python3.13/site-packages/torchvision/ops/focal_loss.pyr   r      s4   : O!O"07klmm99!!##EII,@,@,B,B./fA00FSG
+Q1w;/
/Cq3w5()Dz/QY1w;$??~ F K 
f	yy{ K 
e	xxz
 K 29+=qr
 	
    )g      ?r   r   )r   torch.nn.functionalnn
functionalr   utilsr   Tensorfloatstrr    r    r   <module>r)      se       ' 6LL6\\6 6 	6
 6 \\6r    