# DFTSpatialRelationLocationEncoder Documentation ## Overview The `DFTSpatialRelationLocationEncoder` is designed to process spatial relations between locations using Discrete Fourier Transform (DFT) principles adapted for spatial encoding. It utilizes the `DFTSpatialRelationPositionEncoder` to transform spatial coordinates into a frequency domain, enhancing the model's ability to capture and interpret spatial relationships across various scales. ## Features - **Position Encoding (`self.position_encoder`)**: Utilizes `DFTSpatialRelationPositionEncoder` for transforming spatial differences into frequency-based representations. - **Feed-Forward Neural Network (`self.ffn`)**: Processes the frequency domain data through a multi-layer neural network to generate final spatial embeddings. ## Configuration Parameters - `spa_embed_dim`: Dimensionality of the output spatial embeddings. - `coord_dim`: Dimensionality of the coordinate space (typically 2D). - `frequency_num`: Number of frequency components used in the positional encoding. - `max_radius`: Maximum distance considered for spatial interactions. - `min_radius`: Minimum distance that can be resolved by the encoding. - `freq_init`: Method used for initializing the frequency components ('geometric' suggests a regular scaling). - `device`: Computation device used (e.g., 'cuda' for GPU acceleration). - `ffn_act`: Activation function for the neural network layers. - `ffn_num_hidden_layers`: Number of hidden layers in the neural network. - `ffn_dropout_rate`: Dropout rate to prevent overfitting during training. - `ffn_hidden_dim`: Dimension of each hidden layer within the network. - `ffn_use_layernormalize`: Whether to use layer normalization. - `ffn_skip_connection`: Whether to include skip connections within the network layers. - `ffn_context_str`: Context string for debugging and detailed logging within the network. ## Methods ### `forward(coords)` - **Purpose**: Processes input coordinates through the encoder to produce spatial embeddings. - **Parameters**: - `coords` (List or np.ndarray): Coordinates to process, formatted as `(batch_size, num_context_pt, coord_dim)`. - **Returns**: - `sprenc` (Tensor): The final spatial relation embeddings, shaped `(batch_size, num_context_pt, spa_embed_dim)`. > ## DFTSpatialRelationPositionEncoder ### Overview This position encoder leverages Discrete Fourier Transform (DFT) techniques to encode spatial coordinates into the frequency domain, enabling the model to recognize patterns and relationships that are not immediately apparent in the spatial domain.