FeatureStoreο
- class dgl.graphbolt.FeatureStore[source]ο
Bases:
object
A store to manage multiple features for access.
- keys()[source]ο
Get the keys of the features.
- Returns:
The keys of the features. The tuples are in (domain, type_name, feat_name) format.
- Return type:
List[tuple]
- metadata(domain: str, type_name: str, feature_name: str)[source]ο
Get the metadata of the specified feature in the feature store.
- read(domain: str, type_name: str, feature_name: str, ids: Tensor | None = None)[source]ο
Read from the feature store.
- Parameters:
domain (str) β The domain of the feature such as βnodeβ, βedgeβ or βgraphβ.
type_name (str) β The node or edge type name.
feature_name (str) β The feature name.
ids (torch.Tensor, optional) β The index of the feature. If specified, only the specified indices of the feature are read. If None, the entire feature is returned.
- Returns:
The read feature.
- Return type:
torch.Tensor
- size(domain: str, type_name: str, feature_name: str)[source]ο
Get the size of the specified feature in the feature store.
- update(domain: str, type_name: str, feature_name: str, value: Tensor, ids: Tensor | None = None)[source]ο
Update the feature store.
- Parameters:
domain (str) β The domain of the feature such as βnodeβ, βedgeβ or βgraphβ.
type_name (str) β The node or edge type name.
feature_name (str) β The feature name.
value (torch.Tensor) β The updated value of the feature.
ids (torch.Tensor, optional) β The indices of the feature to update. If specified, only the specified indices of the feature will be updated. For the feature, the ids[i] row is updated to value[i]. So the indices and value must have the same length. If None, the entire feature will be updated.