torch_ecg.utils.default_collate_fn

torch_ecg.utils.default_collate_fn(batch: Sequence[Union[Tuple[numpy.ndarray, ...], Dict[str, numpy.ndarray]]]) Union[Tuple[torch.Tensor, ...], Dict[str, torch.Tensor]][source]

Default collate functions for model training.

The data generator (Dataset) should generate (__getitem__) n-tuples signals, labels, ..., or dictionaries of tensors.

Parameters

batch (sequence) – Sequence of n-tuples, in which the first element is the signal, the second is the label, …; or sequence of dictionaries of tensors.

Returns

Tuple or dict of Tensor, which are the concatenated values to feed into neural networks.

Return type

tuple or dict