Skip to content

Commit a1238f0

Browse files
committed
Fix Parametrizations tutorial
1 parent 9a44439 commit a1238f0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

intermediate_source/parametrizations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +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+
eps = 1e-6 # Add small regularization to avoid singularity
311+
reg_term = eps * self.Id
310312
return torch.linalg.solve(A + self.Id, self.Id - A)
311313

312314
layer_orthogonal = nn.Linear(3, 3)

0 commit comments

Comments
 (0)