Skip to content

Commit cbbf077

Browse files
Small optimizations.
1 parent 0c04a6a commit cbbf077

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

comfy/ldm/modules/distributions/distributions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def __init__(self, parameters, deterministic=False):
3030
self.std = torch.exp(0.5 * self.logvar)
3131
self.var = torch.exp(self.logvar)
3232
if self.deterministic:
33-
self.var = self.std = torch.zeros_like(self.mean).to(device=self.parameters.device)
33+
self.var = self.std = torch.zeros_like(self.mean, device=self.parameters.device)
3434

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

3939
def kl(self, other=None):

0 commit comments

Comments
 (0)