Skip to content
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion intermediate_source/parametrizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def forward(self, X):
# Inspecting a parametrized module
# --------------------------------
#
# When a module is parametrized, we find that the module has changed in three ways:
# When a module is parametrized, we find that the module has changed in the following ways:
#
# 1) ``model.weight`` is now a property
#
Expand Down Expand Up @@ -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)
Expand Down
Loading