torch.cuda.comm.broadcast_coalesced#
- torch.cuda.comm.broadcast_coalesced(tensors, devices, buffer_size=10485760)[源代码]#
将一系列 tensor 广播到指定的 GPU。
较小的 tensor 会先合并到一个缓冲区中,以减少同步次数。
- 参数
tensors (sequence) – 要广播的 tensor。必须在同一设备上,可以是 CPU 或 GPU。
devices (Iterable[torch.device, str 或 int]) – GPU 设备的可迭代对象,将在其中进行广播。
buffer_size (int) – 用于合并的缓冲区的最大大小
- 返回
一个包含
tensor
副本的元组,放置在devices
上。