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