spd_learn.functional.sample_covariance#

spd_learn.functional.sample_covariance(input: Tensor) → Tensor[source]#

Computes the sample covariance matrix of multivariate data.

The input tensor is assumed to have shape (…, n_channels, n_times), where … represents any number of leading dimensions. The sample covariance is scaled by (n_times - 1).

Parameters:

input (torch.Tensor) – Input tensor with shape (…, n_channels, n_times).

Returns:

Sample covariance matrices with shape (…, n_channels, n_channels).

Return type:

torch.Tensor