def METHOD_NAME(batch):
    src_batch, tgt_batch = [], []
    for src, tgt in batch:
        src_batch.append(src)
        tgt_batch.append(tgt)
    src_lengths = torch.tensor([len(s)
                               for s in src_batch], dtype=torch.int32)
    src_batch = pad_sequence(src_batch, padding_value=0)
    tgt_lengths = torch.tensor([len(s)
                               for s in tgt_batch], dtype=torch.int32)
    tgt_batch = pad_sequence(tgt_batch, padding_value=0)
    return src_batch.transpose(0, 1).contiguous(), tgt_batch.transpose(
        0, 1).contiguous(), src_lengths, tgt_lengths