mr2.nn.AbsolutePositionEncoding
- class mr2.nn.AbsolutePositionEncoding[source]
Bases:
ModuleAbsolute position encoding layer.
Encodes absolute positions in a grid. Has no learnable parameters.
- __init__(n_dim: int, n_features: int, include_radii: bool = True, base_resolution: int = 128)[source]
Initialize absolute position encoding layer.
- Parameters:
n_dim (
int) – Dimensions of the input space (1, 2, or 3)n_features (
int) – Number of features to encode. The input to the forward pass needs to have at least this many features/channels.include_radii (
bool, default:True) – Whether to include radius featuresbase_resolution (
int, default:128) – Base resolution for position encoding. Encodings are generated at this resolution and interpolated to the input shape in the forward pass.