MCPcopy Create free account
hub / github.com/Gadersd/stable-diffusion-burn / timestep_embedding

Function timestep_embedding

python/test.py:31–35  ·  view source on GitHub ↗
(timesteps, dim, max_period=10000)

Source from the content-addressed store, hash-verified

29print(out)'''
30
31def timestep_embedding(timesteps, dim, max_period=10000):
32 half = dim // 2
33 freqs = (-math.log(max_period) * torch.arange(half) / half).exp()
34 args = timesteps * freqs
35 return torch.cat( (args.cos(), args.sin()) ).reshape(1, -1)
36
37timesteps = Tensor([1, 2, 3]).reshape((3, 1))
38dim = 10

Callers 1

test.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected