diffusion_models.models.positional_encoding.PositionalEncoding¶
- class diffusion_models.models.positional_encoding.PositionalEncoding(d_model=256, dropout=0.1, max_len=5000)[source]¶
Bases:
Module
- __init__(d_model=256, dropout=0.1, max_len=5000)[source]¶
Constructor of PositionalEncoding class.
- Parameters:
d_model (
int
) – feature dimensionality of the modeldropout (
float
) – probability value of dropout layersmax_len (
int
) – maximum length of sequence (shorter setting will free up GPU memory)
Methods
__init__
([d_model, dropout, max_len])Constructor of PositionalEncoding class.
forward
(x)- type x:
Tensor, 'length batch features')
Get positional encoding for position/timestep t.