kaira.models.ChannelCodeModel

Inheritance diagram of ChannelCodeModel

Inheritance diagram for ChannelCodeModel

class kaira.models.ChannelCodeModel(encoder: BaseModel, constraint: BaseConstraint, modulator: BaseModulator, channel: BaseChannel, demodulator: BaseDemodulator, decoder: BaseModel, *args: Any, **kwargs: Any)[source]

Bases: SequentialModel

A specialized model for Channel Code.

Channel Code is an information transmission approach that performs encoding and decoding using given channel code. This model connects an encoder, power constraint, channel simulator, and decoder in an information transmission system.

The typical workflow is: 1. Input data is encoded with additional redundancy for further information recovery 2. The encoded representation is power-constrained 3. The constrained representation is modulated and passed over a noisy channel 4. The decoder reconstructs the original data from the demodulated channel output

encoder

Channel code encoder that algorithmically encodes the input

Type:

BaseModel

constraint

Module that applies power constraints to the encoded signal

Type:

BaseConstraint

modulator

Module that modulates the encoded signal

Type:

BaseModulator

channel

Simulates the communication channel effects

Type:

BaseChannel

demodulator

Module that demodulates the received signal

Type:

BaseDemodulator

decoder

Channel code decoder that algorithmically reconstructs the input from the received signal

Type:

BaseModel

Methods

__init__

Initialize the Channel Code model.

add_step

Add a processing step to the model.

forward

Execute the model sequentially on the input data.

remove_step

Remove a processing step from the model.

__init__(encoder: BaseModel, constraint: BaseConstraint, modulator: BaseModulator, channel: BaseChannel, demodulator: BaseDemodulator, decoder: BaseModel, *args: Any, **kwargs: Any)[source]

Initialize the Channel Code model.

Parameters:
  • encoder (BaseModel) – Channel code encoder for encoding the input

  • constraint (BaseConstraint) – Module for applying power constraints to the encoded signal

  • modulator (BaseModulator) – Module for modulating the encoded signal

  • channel (BaseChannel) – Module simulating the communication channel

  • demodulator (BaseDemodulator) – Module for demodulating the received signal

  • decoder (BaseModel) – Channel code decoder for decoding the demodulated channel output

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

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

add_step(step: Callable) ConfigurableModel

Add a processing step to the model.

Parameters:

step – A callable that will be added to the processing pipeline. Must accept and return tensor-like objects.

Returns:

Self for method chaining

forward(input_data: Any, *args: Any, **kwargs: Any) Any

Execute the model sequentially on the input data.

Parameters:
  • input_data – The initial data to process

  • *args – Additional positional arguments passed to each step.

  • **kwargs – Additional keyword arguments passed to each step.

Returns:

The final result after passing through all steps

remove_step(index: int) ConfigurableModel

Remove a processing step from the model.

Parameters:

index – The index of the step to remove

Returns:

Self for method chaining

Raises:

IndexError – If the index is out of range