`if not (labels == 0).any()`, or `if (labels != 0).all()`, is more readable to me.