def merge_tgt_pos(key, left_pad, move_eos_to_beginning=False): return data_utils.collate_tokens( [s[key] for s in samples], -2, eos_idx, left_pad, move_eos_to_beginning, )
def merge(key, left_pad, move_eos_to_beginning=False, pad_idx=pad_idx): return data_utils.collate_tokens( [s[key] for s in samples], pad_idx, eos_idx, left_pad, move_eos_to_beginning, )