Make _apply_transform return indices of unique elements.