MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / forward

Method forward

diffsynth/models/sd_unet.py:11–17  ·  view source on GitHub ↗
(self, timesteps)

Source from the content-addressed store, hash-verified

9 self.num_channels = num_channels
10
11 def forward(self, timesteps):
12 half_dim = self.num_channels // 2
13 exponent = -math.log(10000) * torch.arange(start=0, end=half_dim, dtype=torch.float32, device=timesteps.device) / half_dim
14 timesteps = timesteps.unsqueeze(-1)
15 emb = timesteps.float() * torch.exp(exponent)
16 emb = torch.cat([torch.cos(emb), torch.sin(emb)], dim=-1)
17 return emb
18
19
20class GEGLU(torch.nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected