spd_learn.functional.ensure_sym#
- spd_learn.functional.ensure_sym(matrix)[source]#
Ensures that a matrix is symmetric.
This function ensures that the last two dimensions of a tensor represent a symmetric matrix by averaging the matrix with its transpose.
- Parameters:
matrix (torch.Tensor) – A tensor with at least two dimensions, where the last two dimensions form a square matrix.
- Returns:
The symmetric version of the input matrix.
- Return type: