ocl.neural_networks.positional_embedding
Implementation of different positional embeddings.
SoftPositionEmbed
Embeding of positions using convex combination of learnable tensors.
This assumes that the input positions are between 0 and 1.
Source code in ocl/neural_networks/positional_embedding.py
__init__
init.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_spatial_dims |
int
|
Number of spatial dimensions. |
required |
feature_dim |
int
|
Dimensionality of the input features. |
required |
cnn_channel_order |
bool
|
Assume features are in CNN channel order (i.e. C x H x W). |
False
|
savi_style |
bool
|
Use savi style positional encoding, where positions are normalized between -1 and 1 and a single dense layer is used for embedding. |
False
|
Source code in ocl/neural_networks/positional_embedding.py
LearnedAdditivePositionalEmbed
Add positional encoding as in SLATE.
Source code in ocl/neural_networks/positional_embedding.py
DummyPositionEmbed
Embedding that just passes through inputs without adding any positional embeddings.