MCPcopy Create free account
hub / github.com/pytorch/tutorials / right_inverse

Method right_inverse

intermediate_source/parametrizations.py:306–310  ·  view source on GitHub ↗
(self, A)

Source from the content-addressed store, hash-verified

304 return torch.linalg.solve(self.Id - X, self.Id + X)
305
306 def right_inverse(self, A):
307 # Assume A orthogonal
308 # See https://en.wikipedia.org/wiki/Cayley_transform#Matrix_map
309 # (A - I)(A + I)^{-1}
310 return torch.linalg.solve(A + self.Id, self.Id - A)
311
312layer_orthogonal = nn.Linear(3, 3)
313parametrize.register_parametrization(layer_orthogonal, "weight", Skew())

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected