FeatureΒΆ

class dgl.graphbolt.Feature[source]ΒΆ

Bases: object

A wrapper of feature data for access.

metadata()[source]ΒΆ

Get the metadata of the feature.

Returns

The metadata of the feature.

Return type

Dict

read(ids: Optional[torch.Tensor] = None)[source]ΒΆ

Read from the feature.

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

The read feature.

Return type

torch.Tensor

size()[source]ΒΆ

Get the size of the feature.

Returns

The size of the feature.

Return type

torch.Size

update(value: torch.Tensor, ids: Optional[torch.Tensor] = None)[source]ΒΆ

Update the feature.

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.