kaira.models.components.Projection

Inheritance diagram of Projection

Inheritance diagram for Projection

class kaira.models.components.Projection(in_features: int, out_features: int, projection_type: ProjectionType | str = ProjectionType.ORTHOGONAL, seed: int | None = None, trainable: bool = True, dtype: dtype | None = None, *args: Any, **kwargs: Any)[source]

Bases: BaseModel

Projection layer for dimensionality reduction in communication systems [Yilmaz et al., 2025, Yilmaz et al., 2025].

This module implements different projection methods that can be used for dimensionality reduction in communication systems. These projection methods have been adapted from those used in [Yilmaz et al., 2025] and [Yilmaz et al., 2025]. The projection only operates on the last dimension of the input tensor and uses matrix multiplication.

Available projection types: * RADEMACHER: Random matrix with values {-1, 1} (binary) * GAUSSIAN: Random matrix with values from N(0, 1/out_features) * ORTHOGONAL: Matrix with orthogonal columns (real-valued) * COMPLEX_GAUSSIAN: Complex matrix with real and imaginary parts from N(0, 1/(2*out_features)) * COMPLEX_ORTHOGONAL: Complex matrix with orthogonal columns

Complex projections are particularly useful for wireless communication systems where signals are often represented in the complex domain with I/Q components.

Methods

__init__

Initialize the Projection layer.

extra_repr

Return extra representation string for the module.

forward

Forward pass of the Projection layer.

__init__(in_features: int, out_features: int, projection_type: ProjectionType | str = ProjectionType.ORTHOGONAL, seed: int | None = None, trainable: bool = True, dtype: dtype | None = None, *args: Any, **kwargs: Any)[source]

Initialize the Projection layer.

Parameters:
  • in_features (int) – The dimensionality of the input features.

  • out_features (int) – The dimensionality of the output features.

  • projection_type (ProjectionType or str, optional) – Type of projection to use. Possible values as enum: ProjectionType.RADEMACHER, ProjectionType.GAUSSIAN, ProjectionType.ORTHOGONAL, ProjectionType.COMPLEX_GAUSSIAN, ProjectionType.COMPLEX_ORTHOGONAL. Possible values as str: “rademacher”, “gaussian”, “orthogonal”, “complex_gaussian”, “complex_orthogonal”. Default is ProjectionType.ORTHOGONAL.

  • seed (int, optional) – Random seed for reproducibility. Default is None.

  • trainable (bool, optional) – Whether the projection matrix is trainable. Default is True.

  • dtype (torch.dtype, optional) – The dtype of the projection matrix. Default is None, which will use float32 for real projections and complex64 for complex projections.

  • *args – Variable positional arguments passed to the base class.

  • **kwargs – Variable keyword arguments passed to the base class.

forward(x: Tensor, *args: Any, **kwargs: Any) Tensor[source]

Forward pass of the Projection layer.

Parameters:
  • x (torch.Tensor) – Input tensor with the last dimension being the features. For complex projections, x can be either a complex tensor or a real tensor. If x is real and the projection is complex, x will be treated as having only real components.

  • *args – Additional positional arguments (unused).

  • **kwargs – Additional keyword arguments (unused).

Returns:

Output tensor with the last dimension projected.

If the projection is complex, the output will be complex.

Return type:

torch.Tensor

extra_repr() str[source]

Return extra representation string for the module.