diffusion_models.models.nn.timestep_embedding

diffusion_models.models.nn.timestep_embedding(timesteps, dim, max_period=10000)[source]

Create sinusoidal timestep embeddings.

Parameters:
  • timesteps – a 1-D Tensor of N indices, one per batch element. These may be fractional.

  • dim – the dimension of the output.

  • max_period – controls the minimum frequency of the embeddings.

Returns:

an [N x dim] Tensor of positional embeddings.