docstr: Return the rank of a CP Decomposition.
  
  Parameters
  ----------
  tensor_shape
      shape of the tensor to decompose
  rank
      way to determine the rank, by default 'same'
      if 'same': rank is computed to keep the number
      of parameters (at most) the same
      if float, computes a rank so as to keep rank
      percent of the original number of parameters
      if int, just returns rank
  rounding
      {'round', 'floor', 'ceil'}
  
  Returns
  -------
  rank
      rank of the decomposition
docstr_tok: ["Return","the","rank","of","a","CP","Decomposition",".","Parameters","--","--","--","--","--","tensor_shape","shape","of","the","tensor","to","decompose","rank","way","to","determine","the","rank",",","by","default","'same'","if","'same","'",":","rank","is","computed","to","keep","the","number","of","parameters","(","at","most",")","the","same","if","float",",","computes","a","rank","so","as","to","keep","rank","percent","of","the","original","number","of","parameters","if","int",",","just","returns","rank","rounding","{","'round","'",",","'floor","'",",","'ceil","'","}","Returns","--","--","--","-","rank","rank","of","the","decomposition"]
code: def validate_cp_rank(tensor_shape, rank="same", rounding="round"):
      """Return the rank of a CP Decomposition.
  
      Parameters
      ----------
      tensor_shape
          shape of the tensor to decompose
      rank
          way to determine the rank, by default 'same'
          if 'same': rank is computed to keep the number
          of parameters (at most) the same
          if float, computes a rank so as to keep rank
          percent of the original number of parameters
          if int, just returns rank
      rounding
          {'round', 'floor', 'ceil'}
  
      Returns
      -------
      rank
          rank of the decomposition
      """
      if rounding == "ceil":
          rounding_fun = ivy.ceil
      elif rounding == "floor":
          rounding_fun = ivy.floor
      elif rounding == "round":
          rounding_fun = ivy.round
      else:
          raise ValueError(
              f"Rounding should be of round, floor or ceil, but got {rounding}"
          )
  
      if rank == "same":
          rank = float(1)
  
      if isinstance(rank, float):
          rank = int(
              rounding_fun(
                  ivy.prod(tensor_shape) * rank / ivy.sum(tensor_shape)
              )
          )
      return rank
  
imports: from .base import FactorizedTensor
  import ivy
label_desc: Use image node_id 17 for calling the CPTensor obj's underlying member method code with example usage: obj.validate_cp_rank(tensor_shape, rank, rounding) and returns: rank