CopyTo๏ƒ

class dgl.graphbolt.CopyTo(datapipe, device, non_blocking=False)[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.

  • non_blocking (bool) โ€“ Whether the copy should be performed without blocking. All elements have to be already in pinned system memory if enabled. Default is False.