torch_geometric.data.get_features_for_triplets_groups

get_features_for_triplets_groups(indexer: LargeGraphIndexer, triplet_groups: Iterable[Iterable[Tuple[Hashable, Hashable, Hashable]]], node_feature_name: str = 'x', edge_feature_name: str = 'edge_attr', pre_transform: Optional[Callable[[Tuple[Hashable, Hashable, Hashable]], Tuple[Hashable, Hashable, Hashable]]] = None, verbose: bool = False) Iterator[Data][source]

Given an indexer and a series of triplet groups (like a dataset), retrieve the specified node and edge features for each triplet from the index.

Parameters:
  • indexer (LargeGraphIndexer) – Indexer containing desired features

  • triplet_groups (Iterable[KnowledgeGraphLike]) – List of lists of triplets to fetch features for

  • node_feature_name (str, optional) – Node feature to fetch. Defaults to “x”.

  • edge_feature_name (str, optional) – edge feature to fetch. Defaults to “edge_attr”.

  • pre_transform (Optional[Callable[[TripletLike], TripletLike]]) – Optional preprocessing to perform on triplets. Defaults to None.

  • verbose (bool, optional) – Whether to print progress. Defaults to False.

Yields:

Iterator[Data]

For each triplet group, yield a data object containing

the unique graph and features from the index.

Return type:

Iterator[Data]