(self, timesteps)
| 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 | |
| 20 | class GEGLU(torch.nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected