CopyTo

class dgl.graphbolt.CopyTo(datapipe, device)[source]

Bases: IterDataPipe

DataPipe that transfers each element yielded from the previous DataPipe to the given device. For MiniBatch, only the related attributes (automatically inferred) will be transferred by default.

Functional name: copy_to.

When data has to method implemented, CopyTo will be equivalent to

for data in datapipe:
    yield data.to(device)
Parameters:
  • datapipe (DataPipe) – The DataPipe.

  • device (torch.device) – The PyTorch CUDA device.