Coverage Control Library
Loading...
Searching...
No Matches
DataLoaderUtils Class Reference

Class to provide utility functions to load tensors and configuration files. More...

Static Public Member Functions

torch.tensor load_maps (str path, bool use_comm_map=False)
 Function to load maps stored as tensors.
 
tuple[torch.tensor, torch.tensor, torch.tensor] load_features (str path, int output_dim=None)
 Function to load normalized features.
 
tuple[torch.tensor, torch.tensor, torch.tensor] load_actions (str path)
 Function to load normalized actions.
 
torch.tensor load_robot_positions (str path)
 Function to load robot positions.
 
torch.tensor load_edge_weights (str path)
 Function to load edge weights.
 
torch_geometric.data.Data to_torch_geometric_data (torch.tensor feature, torch.tensor edge_weights, torch.tensor pos=None)
 The function converts the feature, edge_weights and pos to a torch_geometric.data.Data object This is essential for using the data with the PyTorch Geometric library.
 

Detailed Description

Class to provide utility functions to load tensors and configuration files.

Definition at line 33 of file data_loader_utils.py.

Member Function Documentation

◆ load_actions()

tuple[torch.tensor, torch.tensor, torch.tensor] load_actions ( str path)
static

Function to load normalized actions.

   The actions are stored as tensors in the following format:
   - {path}/normalized_actions.pt: Normalized actions
   - {path}/../actions_mean.pt: Mean of the actions
   - {path}/../actions_std.pt: Standard deviation of the actions
Parameters
pathPath to the directory containing the actions
Returns
actions The loaded actions
actions_mean Mean of the actions
actions_std Standard deviation of the actions

Definition at line 128 of file data_loader_utils.py.

◆ load_edge_weights()

torch.tensor load_edge_weights ( str path)
static

Function to load edge weights.

   The edge weights are stored as tensors in the following format:
   - {path}/edge_weights.pt: Edge weights
Parameters
pathPath to the directory containing the edge weights
Returns
edge_weights The loaded edge weights

Definition at line 168 of file data_loader_utils.py.

◆ load_features()

tuple[torch.tensor, torch.tensor, torch.tensor] load_features ( str path,
int output_dim = None )
static

Function to load normalized features.

   The features are stored as tensors in the following format:
   - {path}/normalized_coverage_features.pt: Normalized coverage features
   - {path}/../coverage_features_mean.pt: Mean of the coverage features
   - {path}/../coverage_features_std.pt: Standard deviation of the coverage features
Parameters
pathPath to the directory containing the features
output_dimOutput dimension of the features
Returns
features The loaded features
features_mean Mean of the features
features_std Standard deviation of the features

Definition at line 86 of file data_loader_utils.py.

◆ load_maps()

torch.tensor load_maps ( str path,
bool use_comm_map = False )
static

Function to load maps stored as tensors.

   The maps are stored as tensors in the following format:
   - {path}/local_maps.pt: Local maps
   - {path}/obstacle_maps.pt: Obstacle maps
   - {path}/comm_maps.pt: Communication maps (if use_comm_map is True)
Parameters
pathPath to the directory containing the maps
use_comm_mapWhether to load the communication map
Returns
maps The loaded maps

Definition at line 52 of file data_loader_utils.py.

◆ load_robot_positions()

torch.tensor load_robot_positions ( str path)
static

Function to load robot positions.

   The robot positions are stored as tensors in the following format:
   - {path}/robot_positions.pt: Robot positions
Parameters
pathPath to the directory containing the robot positions
Returns
robot_positions The loaded robot positions

Definition at line 149 of file data_loader_utils.py.

◆ to_torch_geometric_data()

torch_geometric.data.Data to_torch_geometric_data ( torch.tensor feature,
torch.tensor edge_weights,
torch.tensor pos = None )
static

The function converts the feature, edge_weights and pos to a torch_geometric.data.Data object This is essential for using the data with the PyTorch Geometric library.

Parameters
featureThe feature tensor
edge_weightsThe edge weights tensor
posThe position tensor
Returns
data The torch_geometric.data.Data object
data The feature tensor
data The edge index tensor
data The edge weight tensor
data The position tensor (if pos is not None)

Definition at line 192 of file data_loader_utils.py.