SubsetΒΆ

class dgl.data.utils.Subset(dataset, indices)[source]ΒΆ

Bases: object

Subset of a dataset at specified indices

Code adapted from PyTorch.

Parameters
  • dataset – dataset[i] should return the ith datapoint

  • indices (list) – List of datapoint indices to construct the subset

__getitem__(item)[source]ΒΆ

Get the datapoint indexed by item

Returns

datapoint

Return type

tuple

__len__()[source]ΒΆ

Get subset size

Returns

Number of datapoints in the subset

Return type

int