Skip to content

Commit c764e99

Browse files
committed
docs: stabilize CayleyMap right_inverse
1 parent 04bb15b commit c764e99

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

intermediate_source/parametrizations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ def right_inverse(self, A):
307307
# Assume A orthogonal
308308
# See https://en.wikipedia.org/wiki/Cayley_transform#Matrix_map
309309
# (A - I)(A + I)^{-1}
310-
return torch.linalg.solve(A + self.Id, self.Id - A)
310+
eps = 1e-6
311+
return torch.linalg.solve(A + self.Id + eps * self.Id, self.Id - A)
311312

312313
layer_orthogonal = nn.Linear(3, 3)
313314
parametrize.register_parametrization(layer_orthogonal, "weight", Skew())

0 commit comments

Comments
 (0)