MCPcopy Create free account
hub / github.com/TencentARC/MotionCtrl / __init__

Method __init__

lvdm/distributions.py:25–33  ·  view source on GitHub ↗
(self, parameters, deterministic=False)

Source from the content-addressed store, hash-verified

23
24class DiagonalGaussianDistribution(object):
25 def __init__(self, parameters, deterministic=False):
26 self.parameters = parameters
27 self.mean, self.logvar = torch.chunk(parameters, 2, dim=1)
28 self.logvar = torch.clamp(self.logvar, -30.0, 20.0)
29 self.deterministic = deterministic
30 self.std = torch.exp(0.5 * self.logvar)
31 self.var = torch.exp(self.logvar)
32 if self.deterministic:
33 self.var = self.std = torch.zeros_like(self.mean).to(device=self.parameters.device)
34
35 def sample(self, noise=None):
36 if noise is None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected