(self, x)
| 70 | self.W = nn.Parameter(torch.randn(embedding_size // 2) * scale, requires_grad=False) |
| 71 | |
| 72 | def forward(self, x): |
| 73 | x *= self.W[None, :] * 2 * np.pi |
| 74 | emb = torch.cat([torch.sin(x), torch.cos(x)], dim=-1) |
| 75 | return emb |
| 76 | |
| 77 | |
| 78 | def get_timestep_embedding(embedding_type, embedding_dim, embedding_scale=10000): |
nothing calls this directly
no outgoing calls
no test coverage detected