diff --git a/intermediate_source/parametrizations.py b/intermediate_source/parametrizations.py index 59cff1d241..67aec72029 100644 --- a/intermediate_source/parametrizations.py +++ b/intermediate_source/parametrizations.py @@ -307,6 +307,8 @@ def right_inverse(self, A): # Assume A orthogonal # See https://en.wikipedia.org/wiki/Cayley_transform#Matrix_map # (A - I)(A + I)^{-1} + eps = 1e-6 # Add small regularization to avoid singularity + reg_term = eps * self.Id return torch.linalg.solve(A + self.Id, self.Id - A) layer_orthogonal = nn.Linear(3, 3)