MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / forward

Method forward

slowfast/models/losses.py:25–32  ·  view source on GitHub ↗
(self, x, y)

Source from the content-addressed store, hash-verified

23 self.reduction = reduction
24
25 def forward(self, x, y):
26 loss = torch.sum(-y * F.log_softmax(x, dim=-1), dim=-1)
27 if self.reduction == "mean":
28 return loss.mean()
29 elif self.reduction == "none":
30 return loss
31 else:
32 raise NotImplementedError
33
34
35_LOSSES = {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected