code: def _tt_matrix_n_param(tensorized_shape, rank):
      """Number of parameters of a TT-Matrix decomposition for a given `rank` and full `tensor_shape`.
  
      Parameters
      ----------
      tensorized_shape : int tuple
          shape of the full tensorized matrix to decompose (or approximate)
  
      rank : tuple
          rank of the TT-Matrix decomposition
  
      Returns
      -------
      n_params : int
          Number of parameters of a TT-Matrix decomposition of rank `rank` of a full tensor of shape `tensor_shape`
      """
      n_dim = len(tensorized_shape) // 2
  
      if n_dim * 2 != len(tensorized_shape):
          msg = (
              f"The order of the give tensorized shape is not a multiple of 2."
              "However, there should be as many dimensions for the left side (number of rows)"
              " as of the right side (number of columns). "
              " For instance, to convert a matrix of size (8, 9) to the TT-format, "
              " it can be tensorized to (2, 4, 3, 3) but NOT to (2, 2, 2, 3, 3)."
          )
          raise ValueError(msg)
  
      left_shape = tensorized_shape[:n_dim]
      right_shape = tensorized_shape[n_dim:]
  
      factor_params = []
      for i, (ls, rs) in enumerate(zip(left_shape, right_shape)):
          factor_params.append(rank[i] * ls * rs * rank[i + 1])
  
      return np.sum(factor_params)
  
imports: import tensorly
  from .tenalg import _tt_matrix_to_tensor
  from ._factorized_tensor import FactorizedTensor
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _tt_matrix_n_param(tensorized_shape, rank) and returns: np