code: def symmetric_parafac_power_iteration(
      tensor, rank, n_repeat=10, n_iteration=10, verbose=False
  ):
      """Symmetric CP Decomposition via Robust Symmetric Tensor Power Iteration
  
      Parameters
      ----------
      tensor : tl.tensor
          input tensor to decompose, must be symmetric of shape (size, )*order
      rank : int
          rank of the decomposition (number of rank-1 components)
      n_repeat : int, default is 10
          number of initializations to be tried
      n_iterations : int, default is 10
          number of power iterations
      verbose : bool
          level of verbosity
  
      Returns
      -------
      (weights, factor)
  
      weights : 1-D tl.tensor of length `rank`
          contains the eigenvalue of each eigenvector
      factor : 2-D tl.tensor of shape (size, rank)
          each column corresponds to one eigenvector
      """
      rank = validate_cp_rank(tl.shape(tensor), rank=rank)
  
      order = tl.ndim(tensor)
      size = tl.shape(tensor)[0]
  
      if not tl.shape(tensor) == (size,) * order:
          raise ValueError(
              "The input tensor does not have the same size along each mode."
          )
  
      factor = []
      weights = []
  
      for _ in range(rank):
          eigenval, eigenvec, deflated = symmetric_power_iteration(
              tensor,
              n_repeat=n_repeat,
              n_iteration=n_iteration,
              verbose=verbose,
          )
          factor.append(eigenvec)
          weights.append(eigenval)
          tensor = deflated
  
      factor = tl.stack(factor, axis=1)
      weights = tl.stack(weights)
  
      return weights, factor
  
file_path: tensorly/tensorly/decomposition/_symmetric_cp.py
imports: import tensorly
  from ._base_decomposition import DecompositionMixin
  from tensorly.tenalg import outer
  import numpy
  from ..cp_tensor import validate_cp_rank
label_desc: Use image node_id 2 for calling a global function with example usage: symmetric_parafac_power_iteration(tensor, rank, n_repeat, n_iteration, verbose) and returns: weights,  factor