code: def norm_l0(x, axis=None, eps=0.0):
      r
  
      nl0 = np.sum(np.abs(x) > eps, axis=axis, keepdims=True)
      # If the result has a single element, convert it to a scalar
      if nl0.size == 1:
          nl0 = nl0.ravel()[0]
      return nl0
docs: r"""Compute the :math:`\ell_0` "norm" (it is not really a norm)
  
      .. math::
       \| \mathbf{x} \|_0 = \sum_i \left\{ \begin{array}{ccc}
       0 & \text{if} & x_i = 0 \\ 1 &\text{if}  & x_i \neq 0
       \end{array} \right.
  
      where :math:`x_i` is element :math:`i` of vector :math:`\mathbf{x}`.
  
  
      Parameters
      ----------
      x : array_like
        Input array :math:`\mathbf{x}`
      axis : `None` or int or tuple of ints, optional (default None)
        Axes of `x` over which to compute the :math:`\ell_0` "norm". If
        `None`, an entire multi-dimensional array is treated as a
        vector. If axes are specified, then distinct values are computed
        over the indices of the remaining axes of input array `x`.
      eps : float, optional (default 0.0)
        Absolute value threshold below which a number is considered to be
        zero.
  
      Returns
      -------
      nl0 : float or ndarray
        Norm of `x`, or array of norms treating specified axes of `x`
        as a vector