Rate this Page

torch.cuda.comm.broadcast#

torch.cuda.comm.broadcast(tensor,devices=None,*,out=None)[source]#

Broadcasts a tensor to specified GPU devices.

Parameters
  • tensor (Tensor) – tensor to broadcast. Can be on CPU or GPU.

  • devices (Iterable[torch.device,str orint],optional) – an iterable ofGPU devices, among which to broadcast.

  • out (Sequence[Tensor],optional,keyword-only) – the GPU tensors tostore output results.

Note

Exactly one ofdevices andout must be specified.

Returns

  • Ifdevices is specified,

    a tuple containing copies oftensor, placed ondevices.

  • Ifout is specified,

    a tuple containingout tensors, each containing a copy oftensor.