summary / fengshen /data /data_utils /common_utils.py
fclong's picture
Upload 396 files
8ebda9e
raw
history blame
180 Bytes
def padding_to_maxlength(ids, max_length, pad_id):
cur_len = len(ids)
len_diff = max_length - len(ids)
return ids + [pad_id] * len_diff, [1] * cur_len + [0] * len_diff