# SphereGridSpatialRelationLocationEncoder Documentation ## Overview The `SphereGridSpatialRelationLocationEncoder` is engineered for encoding spatial relationships between locations. It leverages the `SphereGridSpatialRelationPositionEncoder` to initially encode spatial differences, then processes these through a customizable multi-layer feed-forward neural network to produce high-dimensional spatial embeddings. ## Features - **Position Encoding**: Uses the `SphereGridSpatialRelationPositionEncoder` for encoding spatial differences using sinusoidal functions. - **Feed-Forward Neural Network**: Converts the position-encoded data into spatial embeddings through multiple neural network layers. ## Configuration Parameters - **spa_embed_dim**: The dimensionality of the spatial embedding output. - **coord_dim**: The dimensionality of the coordinate space (e.g., 2D, 3D). - **device**: Computation device (e.g., 'cuda'). - **frequency_num**: Number of frequency components used in positional encoding. - **max_radius**: Maximum spatial context radius. - **min_radius**: Minimum spatial context radius. - **freq_init**: Initialization method for frequency calculation, set to 'geometric'. - **ffn_act**: Activation function for the feed-forward layers. - **ffn_num_hidden_layers**: Number of hidden layers in the feed-forward network. - **ffn_dropout_rate**: Dropout rate used in the feed-forward network. - **ffn_hidden_dim**: Dimension of each hidden layer in the feed-forward network. - **ffn_use_layernormalize**: Flag to enable layer normalization in the network. - **ffn_skip_connection**: Flag to enable skip connections in the network. - **ffn_context_str**: Context string for debugging and detailed logging. ## Methods ### `forward(coords)` - **Purpose**: Processes input coordinates through the encoder to produce final spatial embeddings. - **Parameters**: - `coords` (List or np.ndarray): Coordinates to be processed, expected in the format `(batch_size, num_context_pt, coord_dim)`. - **Returns**: - `sprenc` (Tensor): Spatial relation embeddings, shaped `(batch_size, num_context_pt, spa_embed_dim)`. > ## SphereGridSpatialRelationPositionEncoder ### Features - **Sinusoidal Encoding**: Applies sinusoidal functions to encode spatial differences, enhancing the model's ability to learn from these features. - **Configurable Parameters**: Supports customization of encoding parameters such as space dimensionality and computation device.