File size: 204 Bytes
c2f8cf1
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import torch
import torch.distributed as dist


@torch.no_grad()
def solution(tensor: torch.Tensor) -> torch.Tensor:
    out = tensor.clone()
    dist.all_reduce(out, op=dist.ReduceOp.SUM)
    return out