MCPcopy Create free account
hub / github.com/espnet/espnet / recursive_average

Function recursive_average

espnet2/torch_utils/recursive_op.py:52–59  ·  view source on GitHub ↗
(obj, weight: torch.Tensor, distributed: bool = False)

Source from the content-addressed store, hash-verified

50
51
52def recursive_average(obj, weight: torch.Tensor, distributed: bool = False):
53 obj = recursive_sum(obj, weight, distributed)
54 weight = weight.sum()
55 if distributed:
56 torch.distributed.all_reduce(weight, op=ReduceOp.SUM)
57 # Normalize weight to be sum-to-1
58 obj = recursive_divide(obj, weight)
59 return obj, weight

Callers 9

__call__Method · 0.90
train_one_epochMethod · 0.90
valid_one_epochMethod · 0.90
train_one_epochMethod · 0.90
validate_one_epochMethod · 0.90
train_one_epochMethod · 0.90
validate_one_epochMethod · 0.90
train_one_epochMethod · 0.90
validate_one_epochMethod · 0.90

Calls 2

recursive_sumFunction · 0.85
recursive_divideFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…