spd_learn.functional.trace_normalization#
- spd_learn.functional.trace_normalization(covariances: Tensor, epsilon: float | None = None) Tensor[source]#
Performs trace normalization on a batch of covariance matrices.
This function normalizes a batch of covariance matrices by their trace. It also adds a small identity matrix for numerical stability.
- Parameters:
covariances (Tensor) – A batch of covariance matrices with shape (…, n, n).
epsilon (float, optional) – A small value to add to the diagonal of the covariance matrices for numerical stability. If None, uses the value from the unified numerical configuration. Default: None.
- Returns:
The trace-normalized covariance matrices.
- Return type:
Tensor