dgl.multiprocessing.pytorch.call_once_and_share

dgl.multiprocessing.pytorch.call_once_and_share(func, shape, dtype, rank=0)[source]

在 PyTorch 分布式进程组中的一个进程中调用函数,并与其它进程共享结果。

参数:
  • func (callable) – 任何不接受参数并返回任意对象的 callable。

  • shape (tuple[int]) – 共享张量的形状。必须与 func 的输出匹配。

  • dtype (torch.dtype) – 共享张量的数据类型。必须与 func 的输出匹配。

  • rank (int, optional) – 实际执行函数的进程 ID。