MCPcopy
hub / github.com/microsoft/Swin-Transformer / reduce_tensor

Function reduce_tensor

utils.py:176–180  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

174
175
176def reduce_tensor(tensor):
177 rt = tensor.clone()
178 dist.all_reduce(rt, op=dist.ReduceOp.SUM)
179 rt /= dist.get_world_size()
180 return rt
181
182
183def ampscaler_get_grad_norm(parameters, norm_type: float = 2.0) -> torch.Tensor:

Callers 2

validateFunction · 0.90
validateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected