def unique_row_counts(array):
    """
    Thanks https://stackoverflow.com/questions/48473056/number-of-unique-elements-per-row-in-a-numpy-array
    """
    array.sort(axis=1)
    return (array[:, 1:] != array[:, :-1]).sum(axis=1) + 1
