You need to sign in or sign up before continuing.
Unverified Commit 673eb60f authored by Alan Du's avatar Alan Du Committed by GitHub
Browse files

Reformat docstring for `get_timestep_embedding` (#8811)



* Reformat docstring for `get_timestep_embedding`


---------
Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
parent a785992c
...@@ -35,10 +35,21 @@ def get_timestep_embedding( ...@@ -35,10 +35,21 @@ def get_timestep_embedding(
""" """
This matches the implementation in Denoising Diffusion Probabilistic Models: Create sinusoidal timestep embeddings. This matches the implementation in Denoising Diffusion Probabilistic Models: Create sinusoidal timestep embeddings.
:param timesteps: a 1-D Tensor of N indices, one per batch element. Args
These may be fractional. timesteps (torch.Tensor):
:param embedding_dim: the dimension of the output. :param max_period: controls the minimum frequency of the a 1-D Tensor of N indices, one per batch element. These may be fractional.
embeddings. :return: an [N x dim] Tensor of positional embeddings. embedding_dim (int):
the dimension of the output.
flip_sin_to_cos (bool):
Whether the embedding order should be `cos, sin` (if True) or `sin, cos` (if False)
downscale_freq_shift (float):
Controls the delta between frequencies between dimensions
scale (float):
Scaling factor applied to the embeddings.
max_period (int):
Controls the maximum frequency of the embeddings
Returns
torch.Tensor: an [N x dim] Tensor of positional embeddings.
""" """
assert len(timesteps.shape) == 1, "Timesteps should be a 1d-array" assert len(timesteps.shape) == 1, "Timesteps should be a 1d-array"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment