OrthogonalBlock#
- class OrthogonalBlock(dim=-1, requires_grad=True)[source]#
Bases:
Module
Module to make the input orthonormal. The module takes a tensor of size \([N, M]\) and returns a tensor of size \([N, M]\) where the columns are orthonormal. The block performs a Gram Schmidt orthogonalization process for the input, see here <https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process> for details.
Initialize the OrthogonalBlock module.
- Parameters:
- forward(X)[source]#
Forward pass of the OrthogonalBlock module using a Gram-Schmidt algorithm.
- Raises:
Warning – If the dimension is greater than the other dimensions.
- Parameters:
X (torch.Tensor) – The input tensor to orthogonalize. The input must be of dimensions \([N, M]\).
- Returns:
The orthonormal tensor.
- property dim#
Get the dimension along which operations are performed.
- Returns:
The current dimension value.
- Return type: