yuns
MultiLabelSoftMarginLoss 본문
반응형
pytorch.org/docs/stable/generated/torch.nn.MultiLabelSoftMarginLoss.html
multi-label일 때 torch에서 지원하는 loss가 있다.
class torch.nn.MultiLabelSoftMarginLoss(weight=None, size_average=None, reduce=None, reduction='mean')
[input]
- weight(type: Tensor) - 각 클래스의 가중치(a manual rescaling weight given to each class)
- size_average(type: bool)
- 각 손실 요소에 대하여 평균화
- By default, the losses are averaged over each loss element in the batch. Note that for some losses, there are multiple elements per sample. If the field size_average is set to False, the losses are instead summed for each minibatch. Ignored when reduce is False. Default: True
- reduce(type: bool)
- reduction(type: string)
$x$: in
$$loss(x, y) = -\frac{1}{C} (\sum_i y[i]log((1+exp(-x[i]))^{(-1)} + (1 - y[i])log(\frac{exp(-x[i])}{1+exp(-x[i])} ))$$
반응형
'pytorch module 정리' 카테고리의 다른 글
pytorch 설치하기 (0) | 2021.06.16 |
---|---|
torch.diag() (0) | 2021.04.21 |
F.log_softmax() (0) | 2021.04.21 |
torchvision.datasets (cococaptions) (0) | 2021.04.20 |
Comments