code: def normalized_sparsity_prox(tensor, threshold):
      """
      Normalized sparsity operator by using hard thresholding.
      The input is projected on the intersection of the unit l2 ball with the set of threshold-sparse vectors
      \\{||x||_2^2=1 and ||x||_0\\leq threshold \\}
  
      Parameters
      ----------
      tensor : ndarray
      threshold : int
                  target sparsity level
  
      Returns
      -------
      ndarray
  
      References
      ----------
      .. [1]: Le Magoarou, L., & Gribonval, R. (2016). Flexible multilayer
              sparse approximations of matrices and applications.
              IEEE Journal of Selected Topics in Signal Processing, 10(4), 688-700.
  
      Notes
      -----
      .. math::
          \\begin{equation}
              prox_\\threshold (||tensor||_0) / ||prox_(\\threshold ||tensor||_0)||_2
          \\end{equation}
      """
      tensor_hard = hard_thresholding(tensor, threshold)
      return tensor_hard / tl.norm(tensor_hard)
  
file_path: tensorly/tensorly/tenalg/proximal.py
imports: import tensorly
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: normalized_sparsity_prox(tensor, threshold) and returns: unknown