def remove_pad_sequences(sequences, pad_id=<NUM_LIT:0>):
sequences_out = copy.deepcopy(sequences)<EOL>for i, _ in enumerate(sequences):<EOL><INDENT>for j in range(<NUM_LIT:1>, len(sequences[i])):<EOL><INDENT>if sequences[i][-j] != pad_id:<EOL><INDENT>sequences_out[i] = sequences_out[i][<NUM_LIT:0>:-j + <NUM_LIT:1>]<EOL>break<EOL><DEDENT><DEDENT><DEDENT>return sequences_out<EOL>
Remove padding.

    Parameters
    -----------
    sequences : list of list of int
        All sequences where each row is a sequence.
    pad_id : int
        The pad ID.

    Returns
    ----------
    list of list of int
        The processed sequences.

    Examples
    ----------
    >>> sequences = [[2,3,4,0,0], [5,1,2,3,4,0,0,0], [4,5,0,2,4,0,0,0]]
    >>> print(remove_pad_sequences(sequences, pad_id=0))
    [[2, 3, 4], [5, 1, 2, 3, 4], [4, 5, 0, 2, 4]]