Datasets:
| import torch | |
| import torch.distributed as dist | |
| def solution(tensor: torch.Tensor, src: int = 0) -> torch.Tensor: | |
| out = tensor.clone() | |
| dist.broadcast(out, src=src) | |
| return out | |
| import torch | |
| import torch.distributed as dist | |
| def solution(tensor: torch.Tensor, src: int = 0) -> torch.Tensor: | |
| out = tensor.clone() | |
| dist.broadcast(out, src=src) | |
| return out | |