def test_dclloss_matches_reference(
        self, batch_size: int, dim: int, temperature: float, seed: int = 0
    ) -> None:
        """
        Ensure patched DCLLoss matches loop-based reference for multiple configs.
        """
        torch.manual_seed(seed)
        out0 = torch.randn(batch_size, dim)
        out1 = torch.randn(batch_size, dim)

        loss_fn = DCLLoss(temperature=temperature)
        patched = loss_fn(out0, out1)

        ref = dcl_reference(out0, out1, temperature)
        assert torch.allclose(
            patched, ref
        ), f"patch={patched.item():.6f} vs ref={ref.item():.6f}"

        Ensure patched DCLLoss matches loop-based reference for multiple configs.
        
tests/loss/test_dcl_loss.py