[MNT] SIGReg cleanup: dedup tests, backfill docstring, document weights (#1925)
* Remove duplicate TestSIGReg class * LeJEPALoss distributed test mock consistency TestLeJEPALoss.test_forward_gather_distributed_world_size_gt_one was using the pre-1923 mock pattern that only patched torch.distributed.all_reduce. The assertion call_count == 3 passed only because torch.distributed.nn.all_reduce is internally implemented via torch.distributed.all_reduce, so the mock caught both APIs together. Mock the two APIs separately and assert their counts individually (c10d all_reduce: 1 call for num_samples_tensor, nn all_reduce: 2 calls for cos_sum and sin_sum), matching the pattern TestSIGReg uses after #1923. * Backfill SIGReg class docstring * Document trapezoidal weights symmetry exploit Added an inline comment explaining the symmetry exploit, the SIGReg integrand (cos_mean - phi)^2 + sin_mean^2 is even in t, so the integral over [-t_max, t_max] equals twice the integral over [0, t_max]. Evaluating at only the non-negative knots and doubling the trapezoidal weights gives the same result while halving the number of knots to evaluate. --------- Co-authored-by: fruet <90271657+gabrielfruet@users.noreply.github.com>
N
Nirbhai committed
7675ddae39f9ae71e74bf6f52181463ee75715df
Parent: c7a06c2
Committed by GitHub <noreply@github.com>
on 5/20/2026, 12:58:15 PM