airpack.pytorch.fileio

Module Contents

class airpack.pytorch.fileio.WaveformDataset(root, dtype, num_samples=None, device=_default_device, transform=None, seed=None, shuffle=False)

Bases: torch.utils.data.Dataset

__getitem__(self, n)

Load the n-th item from the dataset.

Note

The shape of the returned waveform tensor will be whatever is returned by the provided transform. If the transform is None, it will be the shape returned by _load_item().

Parameters

n (int) – The index of the item (file) to be loaded

Returns

tuple: (waveform, labels)

Return type

Tuple[torch.Tensor, Dict]

__len__(self)

Number of samples in this dataset.

Note

For a WaveformFolderDataset, the number of samples is equal to the number of data files contained in the folder.

Return type

int

airpack.pytorch.fileio.load_waveform(data_folder, num_samples, shuffle)

Read in signal data, transform it, and return pytorch dataset

Parameters
  • data_folder (str) – Directory of signal data

  • num_samples (float) – Signal Window length in complex samples

  • shuffle (bool) – Boolean to shuffle samples

Returns

data

Return type

torch.utils.data.Dataset