neuralset.dataloader.Batch

class neuralset.dataloader.Batch(*, segments: Sequence[Segment], data: dict[str, Tensor])[source][source]

A collection of extracted features for a list of segments.

Returned by the SegmentDataset or DataLoader, this object holds both the underlying segments and the computed tensor data ready for machine learning models.

data[source]

The extracted feature tensors. Keys match the names of the extractors passed to the Segmenter. Tensors are always batched along the first dimension.

Type:

dict of str to torch.Tensor

segments[source]

The Segment instances corresponding to this batch. Useful for debugging or custom logic.

Type:

list of Segment

to(device: str) Batch[source][source]

Creates a new instance on the appropriate device