def haar_diag_init_(A):
    """Block-diagonal skew-symmetric matrix with eigenvalues distributed as those from a Haar."""
    haar_init_(A)
    with torch.no_grad():
        An = A.data.cpu().numpy()
        eig = la.eigvals(An).imag
        eig = eig[::2]
        if A.size(0) % 2 == 1:
            eig = eig[:-1]
        eig = torch.tensor(eig)
        return create_diag_(A, eig)
Block-diagonal skew-symmetric matrix with eigenvalues distributed as those from a Haar.
analyze/convnexts4nd/src/models/nn/exprnn/initialization.py