Args: pred (Tensor): The prediction. target (Tensor): Target bboxes. weight (Optional[Tensor], optional): The weight of loss for each prediction. Defaults to None. reduction (str, optional): Options are "none", "mean" and "sum"
(pred: Tensor,
target: Tensor,
weight: Optional[Tensor] = None,
reduction: str = 'mean',
avg_factor: Optional[int] = None,
**kwargs)
| 98 | |
| 99 | @functools.wraps(loss_func) |
| 100 | def wrapper(pred: Tensor, |
| 101 | target: Tensor, |
| 102 | weight: Optional[Tensor] = None, |
| 103 | reduction: str = 'mean', |
| 104 | avg_factor: Optional[int] = None, |
| 105 | **kwargs) -> Tensor: |
| 106 | """ |
| 107 | Args: |
| 108 | pred (Tensor): The prediction. |
| 109 | target (Tensor): Target bboxes. |
| 110 | weight (Optional[Tensor], optional): The weight of loss for each |
| 111 | prediction. Defaults to None. |
| 112 | reduction (str, optional): Options are "none", "mean" and "sum". |
| 113 | Defaults to 'mean'. |
| 114 | avg_factor (Optional[int], optional): Average factor that is used |
| 115 | to average the loss. Defaults to None. |
| 116 | |
| 117 | Returns: |
| 118 | Tensor: Loss tensor. |
| 119 | """ |
| 120 | # get element-wise loss |
| 121 | loss = loss_func(pred, target, **kwargs) |
| 122 | loss = weight_reduce_loss(loss, weight, reduction, avg_factor) |
| 123 | return loss |
| 124 | |
| 125 | return wrapper |
nothing calls this directly
no test coverage detected