MCPcopy Create free account
hub / github.com/chenhaoxing/DiffusionInst / forward

Method forward

diffusioninst/head.py:64–71  ·  view source on GitHub ↗
(self, time)

Source from the content-addressed store, hash-verified

62 self.dim = dim
63
64 def forward(self, time):
65 device = time.device
66 half_dim = self.dim // 2
67 embeddings = math.log(10000) / (half_dim - 1)
68 embeddings = torch.exp(torch.arange(half_dim, device=device) * -embeddings)
69 embeddings = time[:, None] * embeddings[None, :]
70 embeddings = torch.cat((embeddings.sin(), embeddings.cos()), dim=-1)
71 return embeddings
72
73
74class GaussianFourierProjection(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected