MCPcopy Create free account
hub / github.com/LTH14/mar / nll

Method nll

models/vae.py:437–444  ·  view source on GitHub ↗
(self, sample, dims=[1, 2, 3])

Source from the content-addressed store, hash-verified

435 )
436
437 def nll(self, sample, dims=[1, 2, 3]):
438 if self.deterministic:
439 return torch.Tensor([0.0])
440 logtwopi = np.log(2.0 * np.pi)
441 return 0.5 * torch.sum(
442 logtwopi + self.logvar + torch.pow(sample - self.mean, 2) / self.var,
443 dim=dims,
444 )
445
446 def mode(self):
447 return self.mean

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected