Replacing np.all by equivalent np.any