l5kit.planning.vectorized.global_graph module¶
- class l5kit.planning.vectorized.global_graph.MLP(input_dim: int, hidden_dim: int, output_dim: int, num_layers: int)¶
Bases:
torch.nn.modules.module.Module
Very simple multi-layer perceptron (also called FFN)
- forward(x: torch.Tensor) torch.Tensor ¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- reset_parameters() None ¶
- training: bool¶
- class l5kit.planning.vectorized.global_graph.MultiheadAttentionGlobalHead(d_model: int, num_timesteps: int, num_outputs: int, nhead: int = 8, dropout: float = 0.1)¶
Bases:
torch.nn.modules.module.Module
Global graph making use of multi-head attention.
- forward(inputs: torch.Tensor, type_embedding: torch.Tensor, mask: torch.Tensor) Tuple[torch.Tensor, Optional[torch.Tensor]] ¶
Model forward:
- Parameters
inputs – model inputs
type_embedding – type embedding describing the different input types
mask – availability mask
:return tuple of outputs, attention
- training: bool¶
- class l5kit.planning.vectorized.global_graph.VectorizedEmbedding(embedding_dim: int)¶
Bases:
torch.nn.modules.module.Module
- forward(data_batch: Dict[str, torch.Tensor]) torch.Tensor ¶
Model forward: embed the given elements based on their type.
Assumptions: - agent of interest is the first one in the batch - other agents follow - then we have polylines (lanes)
- training: bool¶