summary / fengshen /data /data_utils /common_utils.py
skf15963's picture
Duplicate from fclong/summary
fb238e8
raw
history blame contribute delete
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