(
    data: List[Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]
)
return queries_a, queries_b, is_duplicates
custom collate_fn for DataLoader
    Args:
        data (List[Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]): list of tuples of torch.Tensors
    Returns:
        qpair (Tuple[torch.Tensor, torch.Tensor, torch.Tensor]): tuple of torch.Tensors
custom collate_fn for DataLoader
    Args:
        data (List[Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]): list of tuples of torch.Tensors
    Returns:
        qpair (Tuple[torch.Tensor, torch.Tensor, torch.Tensor]): tuple of torch.Tensors
custom collate_fn for DataLoader Args : data ( List [ Tuple [ torch . Tensor torch . Tensor torch . Tensor ]] ) : list of tuples of torch . Tensors Returns : qpair ( Tuple [ torch . Tensor torch . Tensor torch . Tensor ] ) : tuple of torch . Tensors
def batchify(
    data: List[Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]
) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
    """custom collate_fn for DataLoader
    Args:
        data (List[Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]): list of tuples of torch.Tensors
    Returns:
        qpair (Tuple[torch.Tensor, torch.Tensor, torch.Tensor]): tuple of torch.Tensors
    """
    data = list(zip(*data))
    queries_a, queries_b, is_duplicates = data
    queries_a = pad_sequence(queries_a, batch_first=True, padding_value=1)
    queries_b = pad_sequence(queries_b, batch_first=True, padding_value=1)
    is_duplicates = torch.stack(is_duplicates, 0)

    return queries_a, queries_b, is_duplicates
def batchify ( data : List [ Tuple [ torch . Tensor , torch . Tensor , torch . Tensor ] ] ) -> Tuple [ torch . Tensor , torch . Tensor , torch . Tensor ] : data = list ( zip ( * data ) ) queries_a , queries_b , is_duplicates = data queries_a = pad_sequence ( queries_a , batch_first = True , padding_value = 1 ) queries_b = pad_sequence ( queries_b , batch_first = True , padding_value = 1 ) is_duplicates = torch . stack ( is_duplicates , 0 ) return queries_a , queries_b , is_duplicates