code: def cp_norm(cp_tensor):
      """Returns the l2 norm of a CP tensor
  
      Parameters
      ----------
      cp_tensor : tl.CPTensor or (core, factors)
  
      Returns
      -------
      l2-norm : int
  
      Notes
      -----
      This is ||cp_to_tensor(factors)||^2
  
      You can see this using the fact that
      khatria-rao(A, B)^T x khatri-rao(A, B) = A^T x A  * B^T x B
      """
      _ = _validate_cp_tensor(cp_tensor)
      weights, factors = cp_tensor
  
      norm = T.ones(
          (factors[0].shape[1], factors[0].shape[1]),
          **T.context(factors[0]),
      )
      for f in factors:
          norm = norm * T.dot(T.transpose(f), T.conj(f))
  
      if weights is not None:
          # norm = T.dot(T.dot(weights, norm), weights)
          norm = norm * (
              T.reshape(weights, (-1, 1)) * T.reshape(weights, (1, -1))
          )
  
      # We sum even if weights is not None
      return T.sqrt(T.sum(norm))
  
imports: from .None import backend
  from .base import fold, tensor_to_vec
  from ._factorized_tensor import FactorizedTensor
  from .tenalg import khatri_rao, unfolding_dot_khatri_rao
  from .metrics.factors import congruence_coefficient
  import numpy
label_desc: Use image node_id 11 for calling a global function with example usage: cp_norm(cp_tensor) and returns: T