BinarySource#

class sionna.phy.mapping.BinarySource(precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs: Any)[source]#

Bases: sionna.phy.block.Block

Generates a random binary tensor.

Parameters:
  • precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None, precision is used.

  • device (str | None) – Device for tensor operations. If None, device is used.

  • kwargs (Any)

Inputs:

shape – 1D tensor/array/list, int. Desired shape of the output tensor.

Outputs:

bitsshape, torch.float. Tensor filled with random binary values.

Examples

import torch
from sionna.phy.mapping import BinarySource

source = BinarySource()
bits = source([10, 100])
print(bits.shape)
# torch.Size([10, 100])