项目文件夹

文件

45 行
1.2 KiB
Python

"""Feature store for GraphBolt."""
import torch
__all__ = ["FeatureStore"]
class FeatureStore:
r"""Base class for feature store."""
def __init__(self):
pass
def read(self, ids: torch.Tensor = None):
"""Read from the feature store.
Parameters
----------
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
-------
torch.Tensor
The read feature.
"""
raise NotImplementedError
def update(self, value: torch.Tensor, ids: torch.Tensor = None):
"""Update the feature store.
Parameters
----------
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.
"""
raise NotImplementedError