emmi_inference.models.modules.continuous_sincos_embed¶
Classes¶
Embedding layer for continuous coordinates using sine and cosine functions as used in transformers. |
Module Contents¶
- class emmi_inference.models.modules.continuous_sincos_embed.ContinuousSincosEmbed(dim, ndim, max_wavelength=10000, assert_positive=True)¶
Bases:
torch.nn.ModuleEmbedding layer for continuous coordinates using sine and cosine functions as used in transformers. This implementation is able to deal with arbitrary coordinate dimensions (e.g., 2D and 3D coordinate systems).
- Parameters:
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- dim¶
- ndim¶
- ndim_padding¶
- sincos_padding¶
- max_wavelength = 10000¶
- padding¶
- assert_positive = True¶
- forward(coords)¶
Forward method of the ContinuousSincosEmbed layer.
- Parameters:
coords (torch.Tensor) – Tensor of coordinates. The shape of the tensor should be (batch size, number of points, coordinate dimension) or (number of points, coordinate dimension).
- Returns:
Tensor with embedded coordinates.
- Return type:
torch.Tensor