Skip to content

Types

Defines the core types used throughout Torchradio.

COMPLEX_DTYPE = torch.complex64 module-attribute

The common datatype for all complex tensors in Torchradio.

Reception = dict[str, torch.Tensor] module-attribute

The ReceptionAlgorithm author is free to capture whatever fields are required for downstream loss functions. A Reception is the receiver analogue of Transmission.metadata.

DeviceLogs dataclass

Captures the Transmission and Reception logs from a simulation run.

Each Transmission and Reception is associated with a device name.

Parameters:

Name Type Description Default
tx dict[str, Transmission]

Maps device names to Transmissions.

required
rx dict[str, Reception]

Maps device names to Receptions.

required

ReceptionAlgorithm

Bases: Protocol

All receivers in Torchradio are required to implement a ReceptionAlgorithm.

A ReceptionAlgorithm is any Callable that produces a Reception from an input signal.

__call__(signal)

Return a Reception from a complex-valued input signal.

Parameters:

Name Type Description Default
signal Tensor

A complex-valued input tensor from the environment.

required

Returns:

Type Description
Reception

A Reception with that maps each key to a torch.Tensor for downstream loss functions.

Transmission dataclass

The core output type for any transmitter. A Transmission consists of two parts: a signal and a metadata dictionary.

Parameters:

Name Type Description Default
signal Tensor

A complex-valued tensor that is propagated into the environment

required
metadata dict[str, Tensor]

Used to record arbitrary information that can be used by downstream loss functions. The most commonly used metadata key is 'bits' to capture the bits before the TransmissionAlgortihm produces an output signal.

required

TransmissionAlgorithm

Bases: Protocol

All transmitters in Torchradio are required to implement a TransmissionAlgorithm.

A TransmissionAlgorithm is any Callable that produces a Transmission with a complex-valued signal with shape [batch_size, n_timesteps].

__call__(n_timesteps, batch_size)

Return a Transmission given n_timesteps and batch_size.

Parameters:

Name Type Description Default
n_timesteps int

Number of timesteps to simulate.

required
batch_size int

How many batches to yield.

required

Returns:

Type Description
Transmission

A Transmission with a complex-valued signal with shape [batch_size, n_timesteps].