功能

class dgl.graphbolt.Feature[source]

Bases: object

用于访问的特征数据的包装器。

metadata()[source]

获取特征的元数据。

Returns:

特征的元数据。

Return type:

字典

read(ids: Tensor | None = None)[source]

从特征中读取。

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:

读取功能。

Return type:

torch.Tensor

size()[source]

获取特征的大小。

Returns:

特征的大小。

Return type:

torch.Size

update(value: Tensor, ids: Tensor | None = None)[source]

更新功能。

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.