spd_learn.functional.log_euclidean_mean#

spd_learn.functional.log_euclidean_mean(weights: Tensor, V: Tensor) → Tensor[source]#

Computes the weighted Log-Euclidean mean of a batch of SPD matrices.

The weighted Log-Euclidean mean is computed by taking the weighted average of the matrix logarithms of the SPD matrices, and then taking the matrix exponential of the result.

\[\text{mean}(V) = \exp\left( \sum_i w_i \log(V_i) \right)\]
Parameters:
  • weights (torch.Tensor) – Attention probabilities with shape (…, n, n).

  • V (torch.Tensor) – SPD matrices with shape (…, n, n).

Returns:

The weighted Log-Euclidean mean of the SPD matrices, with shape (…, n, n).

Return type:

torch.Tensor