(data: List[Tuple[torch.Tensor, torch.Tensor]])
return indices, labels
custom collate_fn for DataLoader

    Args:
        data (list): list of torch.Tensors

    Returns:
        data (tuple): tuple of torch.Tensors
custom collate_fn for DataLoader
custom collate_fn for DataLoader
def batchify(data: List[Tuple[torch.Tensor, torch.Tensor]]) -> Tuple[torch.Tensor, torch.Tensor]:
    """custom collate_fn for DataLoader

    Args:
        data (list): list of torch.Tensors

    Returns:
        data (tuple): tuple of torch.Tensors
    """
    indices, labels = zip(*data)
    indices = pad_sequence(indices, batch_first=True, padding_value=1)
    labels = torch.stack(labels, 0)
    return indices, labels
def batchify ( data : List [ Tuple [ torch . Tensor , torch . Tensor ] ] ) -> Tuple [ torch . Tensor , torch . Tensor ] : indices , labels = zip ( * data ) indices = pad_sequence ( indices , batch_first = True , padding_value = 1 ) labels = torch . stack ( labels , 0 ) return indices , labels