MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / reduce_mean

Function reduce_mean

embodiedscan/utils/dist_utils.py:4–10  ·  view source on GitHub ↗

Obtain the mean of tensor on different GPUs.

(tensor)

Source from the content-addressed store, hash-verified

2
3
4def reduce_mean(tensor):
5 """"Obtain the mean of tensor on different GPUs."""
6 if not (dist.is_available() and dist.is_initialized()):
7 return tensor
8 tensor = tensor.clone()
9 dist.all_reduce(tensor.div_(dist.get_world_size()), op=dist.ReduceOp.SUM)
10 return tensor

Callers 3

loss_by_feat_singleMethod · 0.90
_loss_by_feat_singleMethod · 0.90
_loss_by_feat_singleMethod · 0.90

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected