def synchronize_losses(self):
    'Average the losses across the different replicas'
    losses_tensor = torch.tensor(self.losses)
    synchronized_losses_tensor = all_reduce_mean(losses_tensor)
    self.losses = synchronized_losses_tensor.tolist()
Average the losses across the different replicas
def synchronize_losses(self):
    
    losses_tensor = torch.tensor(self.losses)
    synchronized_losses_tensor = all_reduce_mean(losses_tensor)
    self.losses = synchronized_losses_tensor.tolist()