numpy.ndarray.__nonzero__

attribute

ndarray.__nonzero__

x.__nonzero__() <==> x != 0