(tensor, world_size)
return rt
r"""
    Reduces input ''tensor'' across all processes in such a way that everyone
    gets the sum of ''tensor'' from all of the processes.
    Args:
        tensor (Tensor): data to be reduced.
        world_size (int): number of processes.
r"""
    Reduces input ''tensor'' across all processes in such a way that everyone
    gets the sum of ''tensor'' from all of the processes.
    Args:
        tensor (Tensor): data to be reduced.
        world_size (int): number of processes.
r Reduces input tensor across all processes in such a way that everyone gets the sum of tensor from all of the processes . Args : tensor ( Tensor ) : data to be reduced . world_size ( int ) : number of processes .
def reduce_tensor(tensor, world_size):
    r"""
    Reduces input ''tensor'' across all processes in such a way that everyone
    gets the sum of ''tensor'' from all of the processes.
    Args:
        tensor (Tensor): data to be reduced.
        world_size (int): number of processes.
    """
    rt = tensor.clone()
    dist.all_reduce(rt, op=dist.ReduceOp.SUM)
    rt /= world_size
    return rt
def reduce_tensor ( tensor , world_size ) : rt = tensor . clone ( ) dist . all_reduce ( rt , op = dist . ReduceOp . SUM ) rt /= world_size return rt