kaira.data.BinaryTensorDataset

Inheritance diagram for BinaryTensorDataset
- class kaira.data.BinaryTensorDataset(size: List[int] | Size, prob: float = 0.5, device: device | None = None, *args, **kwargs)[source]
Bases:
DatasetDataset of randomly generated binary tensors.
Creates a dataset where each sample is a binary tensor generated with a specified probability of 1s. Useful for simulating binary sources or discrete channels in communication systems experiments.
- data
The generated binary tensor data with shape (n_samples, *feature_dims)
Methods
Initialize the binary tensor dataset.
- __init__(size: List[int] | Size, prob: float = 0.5, device: device | None = None, *args, **kwargs)[source]
Initialize the binary tensor dataset.
- Parameters:
size – Shape of the tensor to generate, where the first dimension represents the number of samples in the dataset
prob – Probability of generating 1s (default: 0.5 for uniform distribution)
device – Device to create the tensor on (default: None, uses default device)
*args – Additional positional arguments (ignored).
**kwargs – Additional keyword arguments (ignored).