MCPcopy Create free account
hub / github.com/VCIP-RGBD/DFormer / reduce_tensor

Function reduce_tensor

utils/pyt_utils.py:116–122  ·  view source on GitHub ↗
(tensor, dst=0, op=dist.ReduceOp.SUM, world_size=1)

Source from the content-addressed store, hash-verified

114
115
116def reduce_tensor(tensor, dst=0, op=dist.ReduceOp.SUM, world_size=1):
117 tensor = tensor.clone()
118 dist.reduce(tensor, dst, op)
119 if dist.get_rank() == dst:
120 tensor.div_(world_size)
121
122 return tensor
123
124
125def all_reduce_tensor(tensor, op=dist.ReduceOp.SUM, world_size=1):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected