mirror of https://github.com/hpcaitech/ColossalAI
fix tensor data update for gemini loss caluculation (#5442)
parent
8020f42630
commit
da885ed540
|
@ -56,6 +56,7 @@ def format_numel_str(numel: int) -> str:
|
|||
|
||||
def all_reduce_mean(tensor: torch.Tensor) -> torch.Tensor:
|
||||
dist.all_reduce(tensor=tensor, op=dist.ReduceOp.SUM)
|
||||
tensor = tensor.data
|
||||
tensor.div_(dist.get_world_size())
|
||||
return tensor
|
||||
|
||||
|
|
Loading…
Reference in New Issue