(self, weight=None, ignore_index=cfg.DATASET.IGNORE_LABEL,
reduction='mean')
| 124 | """ |
| 125 | |
| 126 | def __init__(self, weight=None, ignore_index=cfg.DATASET.IGNORE_LABEL, |
| 127 | reduction='mean'): |
| 128 | super(CrossEntropyLoss2d, self).__init__() |
| 129 | logx.msg("Using Cross Entropy Loss") |
| 130 | self.nll_loss = nn.NLLLoss(weight, reduction=reduction, |
| 131 | ignore_index=ignore_index) |
| 132 | |
| 133 | def forward(self, inputs, targets, do_rmi=None): |
| 134 | return self.nll_loss(F.log_softmax(inputs, dim=1), targets) |