paddlenlp/ops/faster_transformer/sample/bart_decoding_sample.py
def postprocess_seq(seq, bos_idx, eos_idx, output_bos=False, output_eos=False):
    """
    Post-process the decoded sequence.
    """
    eos_pos = len(seq) - 1
    for i, idx in enumerate(seq):
        if idx == eos_idx:
            eos_pos = i
            break
    seq = [
        idx for idx in seq[:eos_pos + 1]
        if (output_bos or idx != bos_idx) and (output_eos or idx != eos_idx)
    ]
    return seq

    Post-process the decoded sequence.
    
Post-process the decoded sequence.
Post - process the decoded sequence .
def postprocess_seq(seq, bos_idx, eos_idx, output_bos=False, output_eos=False):
    eos_pos = len(seq) - 1
    for i, idx in enumerate(seq):
        if idx == eos_idx:
            eos_pos = i
            break
    seq = [
        idx for idx in seq[:eos_pos + 1]
        if (output_bos or idx != bos_idx) and (output_eos or idx != eos_idx)
    ]
    return seq
def postprocess_seq ( seq , bos_idx , eos_idx , output_bos = False , output_eos = False ) : eos_pos = len ( seq ) - 1 for i , idx in enumerate ( seq ) : if idx == eos_idx : eos_pos = i break seq = [ idx for idx in seq [ : eos_pos + 1 ] if ( output_bos or idx != bos_idx ) and ( output_eos or idx != eos_idx ) ] return seq
Post-process the decoded sequence.
Post - process the decoded sequence .
"""
    Post-process the decoded sequence.
    """
seq
bos_idx
eos_idx
output_bos
output_eos