MCPcopy Create free account
hub / github.com/CompVis/diff2flow / nll

Method nll

diff2flow/kl_autoencoder.py:74–80  ·  view source on GitHub ↗
(self, sample, dims=[1,2,3])

Source from the content-addressed store, hash-verified

72 dim=[1, 2, 3])
73
74 def nll(self, sample, dims=[1,2,3]):
75 if self.deterministic:
76 return torch.Tensor([0.])
77 logtwopi = np.log(2.0 * np.pi)
78 return 0.5 * torch.sum(
79 logtwopi + self.logvar + torch.pow(sample - self.mean, 2) / self.var,
80 dim=dims)
81
82 def mode(self):
83 return self.mean

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected