Skip to content

Commit

Permalink
Small optimizations.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Dec 18, 2024
1 parent 0c04a6a commit cbbf077
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions comfy/ldm/modules/distributions/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def __init__(self, parameters, deterministic=False):
self.std = torch.exp(0.5 * self.logvar)
self.var = torch.exp(self.logvar)
if self.deterministic:
self.var = self.std = torch.zeros_like(self.mean).to(device=self.parameters.device)
self.var = self.std = torch.zeros_like(self.mean, device=self.parameters.device)

def sample(self):
x = self.mean + self.std * torch.randn(self.mean.shape).to(device=self.parameters.device)
x = self.mean + self.std * torch.randn(self.mean.shape, device=self.parameters.device)
return x

def kl(self, other=None):
Expand Down

0 comments on commit cbbf077

Please sign in to comment.