docstr: Return the l2 norm of a CP tensor.
  
  Parameters
  ----------
  cp_tensor
      ivy.CPTensor or (core, factors)
  
  Returns
  -------
  l2-norm
  
  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
docstr_tok: ["Return","the","l2","norm","of","a","CP","tensor",".","Parameters","--","--","--","--","--","cp_tensor","ivy.CPTensor","or","(","core",",","factors",")","Returns","--","--","--","-","l2-norm","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"]
code: def cp_norm(cp_tensor):
      """Return the l2 norm of a CP tensor.
  
      Parameters
      ----------
      cp_tensor
          ivy.CPTensor or (core, factors)
  
      Returns
      -------
      l2-norm
  
      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
      """
      _ = ivy.CPTensor.validate_cp_tensor(cp_tensor)
      weights, factors = cp_tensor
  
      norm = ivy.ones(
          (factors[0].shape[1], factors[0].shape[1]),
          dtype=factors[0].dtype,
      )
      for f in factors:
          norm = norm * ivy.dot(
              ivy.permute_dims(f, (1, 0)), ivy.conj(f)
          )
  
      if weights is not None:
          # norm = T.dot(T.dot(weights, norm), weights)
          norm = norm * (
              ivy.reshape(weights, (-1, 1))
              * ivy.reshape(weights, (1, -1))
          )
  
      return ivy.sqrt(ivy.sum(norm))
  
imports: from .base import FactorizedTensor
  import ivy
label_desc: Use image node_id 25 for calling the CPTensor obj's underlying member method code with example usage: obj.cp_norm(cp_tensor) and returns: ivy