code: def sequential_prod(tensor_prod, multiplier_list, left_to_right=True):
      """Perform sequential multiplication and reshaping
  
      Parameters
      ----------
      tensor_prod: ndrray
          the tensor to be multiplied by a list of tensors
          tensor_prod is of dimension r_0*p_1*p_2*...*p_d*r_{d-1}
      multiplier_list: list
          a list of tensors to multiply the tensor
          len(multiplier_list) <= d-1
          If direction == "left", multiplier_list[i] is of shape (r_i, p_{i+1}, r_{i+1})
          If direction == "right", multiplier_list[i] is of shape (r_{d-i}, p_{d-i}, r_{d-i-1})
      left_to_right : bool, optional, default is True
          direction of the multiplication
      Returns
      -------
      tensor_prod : ndarray
          product tensor
          If direction == "left" and `multiplier_list` contains N tensors, then `tensor_prod` is of dimension r_N*p_{N+1}*...*p_d*r_{d-1}
          If direction == "right" and `multiplier_list` contains d-N tensors, then `tensor_prod` is of dimension r_0*p_1*...*p_N*r_N
      """
  
      if left_to_right == True:
          for i in range(len(multiplier_list)):
              tensor_prod = tl.tensordot(
                  multiplier_list[i], tensor_prod, axes=([0, 1], [0, 1])
              )
      else:
          for i in range(len(multiplier_list)):
              tensor_prod = tl.tensordot(
                  tensor_prod,
                  multiplier_list[i],
                  axes=(
                      [
                          tl.ndim(tensor_prod) - 1,
                          tl.ndim(tensor_prod) - 2,
                      ],
                      [0, 1],
                  ),
              )
      return tensor_prod
  
file_path: tensorly/tensorly/contrib/decomposition/tt_TTOI.py
imports: import numpy
  import tensorly
  from tensorly.tt_tensor import tt_to_tensor, validate_tt_rank
  from tensorly.decomposition._base_decomposition import DecompositionMixin
label_desc: Use image node_id 1 for calling a global function with example usage: sequential_prod(tensor_prod, multiplier_list, left_to_right) and returns: tensor_prod