torch.cuda.comm.reduce_add¶ torch.cuda.comm.reduce_add(inputs, destination=None)[原始碼][原始碼]¶ 將來自多個 GPU 的 tensors 加總。 所有輸入應具有相符的形狀、dtype 和 layout。輸出 tensor 將具有相同的形狀、dtype 和 layout。 參數 inputs (Iterable[Tensor]) – 待加總的 tensors 的 iterable。 destination (int, optional) – 輸出將放置的裝置 (預設:目前裝置)。 回傳 包含所有輸入元素級總和的 tensor,放置在 destination 裝置上。