SinusoidalTimeEmbedding#
- class torch_brain.nn.SinusoidalTimeEmbedding(dim, t_min, t_max)[source]#
Bases:
torch.nn.modules.module.ModuleSinusoidal time/position embedding layer. These embeddings are generally added/concatenated to tokens to give them a sense of time/position. The timeperiods are logarithmically spaced between
t_minandt_max(both inclusive).- Parameters:
- forward(timestamps)[source]#
Convert raw timestamps to sinusoidal embeddings
- Parameters:
timestamps (torch.Tensor) – timestamps tensor
- Return type: