MCPcopy
hub / github.com/FareedKhan-dev/train-llm-from-scratch / test_whiten

Function test_whiten

tests/test_rl_math.py:36–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35
36def test_whiten():
37 a = torch.tensor([[1.0, 2.0, 3.0, 0.0]])
38 m = torch.tensor([[1, 1, 1, 0]], dtype=torch.bool)
39 w = whiten(a, m)
40 assert abs(w[0, :3].mean().item()) < 1e-5
41 assert w[0, 3] == 0
42 print("ok whiten: zero-mean over mask, zero outside")
43
44
45def test_ppo_losses():

Callers 1

test_rl_math.pyFile · 0.85

Calls 1

whitenFunction · 0.90

Tested by

no test coverage detected