code: def __init__(self, cp_tensor):
      super().__init__()
  
      shape, rank = _validate_cp_tensor(cp_tensor)
      weights, factors = cp_tensor
  
      # Should we allow None weights?
      if weights is None:
          weights = T.ones(rank, **T.context(factors[0]))
  
      self.shape = shape
      self.rank = rank
      self.factors = factors
      self.weights = weights
  
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 1 to create a new CPTensor object from inherited base classes: FactorizedTensor with example: obj = CPTensor(cp_tensor)