MCPcopy Create free account
hub / github.com/LeapLabTHU/DAT / reduce_tensor

Function reduce_tensor

utils.py:91–95  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

89
90
91def reduce_tensor(tensor):
92 rt = tensor.clone()
93 dist.all_reduce(rt, op=dist.ReduceOp.SUM)
94 rt /= dist.get_world_size()
95 return rt
96
97def init_dist_slurm():
98 """Initialize slurm distributed training environment.

Callers 2

validateFunction · 0.90
validateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected