From a1238f0105b9c786e781b09f47fe528e2de347ae Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Mon, 14 Jul 2025 13:39:23 -0700 Subject: [PATCH 1/3] Fix Parametrizations tutorial --- intermediate_source/parametrizations.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intermediate_source/parametrizations.py b/intermediate_source/parametrizations.py index 59cff1d241c..67aec72029c 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) From 76261dc81888d5452be06797220e83cbd5fb77ee Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Mon, 14 Jul 2025 14:07:29 -0700 Subject: [PATCH 2/3] Update parametrizations.py --- intermediate_source/parametrizations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intermediate_source/parametrizations.py b/intermediate_source/parametrizations.py index 67aec72029c..941703e9cb4 100644 --- a/intermediate_source/parametrizations.py +++ b/intermediate_source/parametrizations.py @@ -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 # From 95aaf0bc59b29c9e0a6aa09f7e287b4a1ba7c74c Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Mon, 14 Jul 2025 15:49:21 -0700 Subject: [PATCH 3/3] Update intermediate_source/parametrizations.py --- intermediate_source/parametrizations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intermediate_source/parametrizations.py b/intermediate_source/parametrizations.py index 941703e9cb4..67aec72029c 100644 --- a/intermediate_source/parametrizations.py +++ b/intermediate_source/parametrizations.py @@ -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 the following ways: +# When a module is parametrized, we find that the module has changed in three ways: # # 1) ``model.weight`` is now a property #