spd_learn.modules.BiMapIncreaseDim#

class spd_learn.modules.BiMapIncreaseDim(in_features: int, out_features: int, device: device | None = None, dtype: dtype | None = None)[source]#

Bases: Module

Bilinear Mapping Layer for SPD Matrix Dimensionality Expansion.

This layer transforms input SPD matrices from shape (…, in_features, in_features) to (…, out_features, out_features) using a semi-orthogonal projection and identity padding, preserving the SPD property.

The transformation is defined as:

\[Y = P + W X W^T\]

where \(X\) is the input SPD matrix, \(W\) is a semi-orthogonal projection matrix, and \(P\) is an identity padding matrix.

Parameters:
  • in_features (int) – Dimensionality of input SPD matrices.

  • out_features (int) – Target dimensionality of output SPD matrices.

  • device (torch.device, optional) – Target device for layer parameters.

  • dtype (torch.dtype, optional) – Data type for layer parameters.

add: Tensor#
forward(input: Tensor) → Tensor[source]#

Forward pass of the BiMapIncreaseDim layer.

Parameters:

input (torch.Tensor) – Input tensor of shape (…, in_features, in_features).

Returns:

Output tensor of shape (…, out_features, out_features).

Return type:

torch.Tensor

projection_matrix: Tensor#