MCPcopy Create free account
hub / github.com/SLDGroup/EMCAD / CrossEntropyLoss2d

Class CrossEntropyLoss2d

utils/misc.py:41–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40
41class CrossEntropyLoss2d(nn.Module):
42 def __init__(self, weight=None, size_average=True, ignore_index=255):
43 super(CrossEntropyLoss2d, self).__init__()
44 self.nll_loss = nn.NLLLoss2d(weight, size_average, ignore_index)
45
46 def forward(self, inputs, targets):
47 return self.nll_loss(F.log_softmax(inputs), targets)
48
49
50class FocalLoss2d(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected