MCPcopy
hub / github.com/idiap/fast-transformers / broadcast

Function broadcast

fast_transformers/aggregate/__init__.py:42–56  ·  view source on GitHub ↗
(Y, G, F, X=None)

Source from the content-addressed store, hash-verified

40
41
42def broadcast(Y, G, F, X=None):
43 device = Y.device
44 if X is None:
45 X = torch.zeros(
46 G.shape + (Y.shape[-1],),
47 device=device,
48 dtype=Y.dtype
49 )
50
51 if device.type == "cpu":
52 broadcast_cpu(Y, G, F, X)
53 else:
54 broadcast_gpu(Y, G, F, X)
55
56 return X
57
58
59# Divide the cluster into groups of equal size

Callers 15

test_broadcast_fullMethod · 0.90
test_broadcast_fullMethod · 0.90
test_simple_gradMethod · 0.90
test_simple_productMethod · 0.90
test_small_benchmarkMethod · 0.90
test_simple_gradMethod · 0.90
test_difficult_gradMethod · 0.90
test_correctnessMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_broadcast_fullMethod · 0.72
test_broadcast_fullMethod · 0.72
test_simple_gradMethod · 0.72
test_simple_productMethod · 0.72
test_small_benchmarkMethod · 0.72
test_simple_gradMethod · 0.72
test_difficult_gradMethod · 0.72
test_correctnessMethod · 0.72