def count_pairs(char_list):
    """Generate pair counts for all pairs of codes in char_list.

    Parameters
    ----------
    char_list: list of arrays of int64
        A list of encoded arrays for which pairs will be counted

    Returns
    -------
    pair_counts: dict of pairs to int
        A dictionary mapping pairs of codes to the count of the total
        number of occurrences of the pair in encoded arrays.
    """
    result = {}
    for array in char_list:
        for i in range(array.shape[0] - 1):
            pair = (array[i], array[i + 1])
            if pair in result:
                result[pair] += 1
            else:
                result[pair] = 1
    return result