dataeval.utils.data.collate.torch_collate_fn

dataeval.utils.data.collate.torch_collate_fn(batch_data_as_singles)

A collate function that takes a batch of individual data points in the format (input, target, metadata) and returns the batched input as a single torch Tensor with two lists: the target batch, and the metadata batch. The inputs must be homogeneous arrays.

Parameters:
batch_data_as_singles : An iterable of (ArrayLike, target, metadata) tuples.

Returns:

A tuple of a torch Tensor and two lists: the input batch, the target batch, and the metadata batch.

Return type:

tuple[torch.Tensor, Sequence[T_tgt], Sequence[T_md]]