MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / get_loss

Method get_loss

sat/sgm/modules/diffusionmodules/loss.py:64–71  ·  view source on GitHub ↗
(self, model_output, target, w)

Source from the content-addressed store, hash-verified

62 return self.get_loss(model_output, input, w)
63
64 def get_loss(self, model_output, target, w):
65 if self.type == "l2":
66 return torch.mean((w * (model_output - target) ** 2).reshape(target.shape[0], -1), 1)
67 elif self.type == "l1":
68 return torch.mean((w * (model_output - target).abs()).reshape(target.shape[0], -1), 1)
69 elif self.type == "lpips":
70 loss = self.lpips(model_output, target).reshape(-1)
71 return loss
72
73
74class VideoDiffusionLoss(StandardDiffusionLoss):

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected