Datasets:
| import torch | |
| import torch.distributed as dist | |
| def solution(tensor: torch.Tensor) -> torch.Tensor: | |
| out = tensor.clone() | |
| dist.all_reduce(out, op=dist.ReduceOp.SUM) | |
| return out | |
| import torch | |
| import torch.distributed as dist | |
| def solution(tensor: torch.Tensor) -> torch.Tensor: | |
| out = tensor.clone() | |
| dist.all_reduce(out, op=dist.ReduceOp.SUM) | |
| return out | |