code: def test_tt_to_tensor():
      """Test for tt_to_tensor
  
      References
      ----------
      .. [1] Anton Rodomanov. "Introduction to the Tensor Train Decomposition
          and Its Applications in Machine Learning", HSE Seminar on Applied
          Linear Algebra, Moscow, Russia, March 2016.
      """
  
      # Create tensor
      n1 = 3
      n2 = 4
      n3 = 2
  
      tensor = np.zeros((n1, n2, n3))
  
      for i in range(n1):
          for j in range(n2):
              for k in range(n3):
                  tensor[i][j][k] = (i + 1) + (j + 1) + (k + 1)
  
      tensor = tl.tensor(tensor)
  
      # Compute ground truth TT factors
      factors = [None] * 3
  
      factors[0] = np.zeros((1, 3, 2))
      factors[1] = np.zeros((2, 4, 2))
      factors[2] = np.zeros((2, 2, 1))
  
      for i in range(3):
          for j in range(4):
              for k in range(2):
                  factors[0][0][i][0] = i + 1
                  factors[0][0][i][1] = 1
  
                  factors[1][0][j][0] = 1
                  factors[1][0][j][1] = 0
                  factors[1][1][j][0] = j + 1
                  factors[1][1][j][1] = 1
  
                  factors[2][0][k][0] = 1
                  factors[2][1][k][0] = k + 1
  
      factors = [tl.tensor(f) for f in factors]
  
      # Check that TT factors re-assemble to the original tensor
      assert_array_almost_equal(tensor, tl.tt_to_tensor(factors))
  
file_path: tensorly/tensorly/tests/test_tt_tensor.py
imports: import numpy
  import tensorly
  from ..decomposition import tensor_train
  from ..tt_tensor import _validate_tt_tensor, pad_tt_rank
  from ..tt_tensor import validate_tt_rank, _tt_n_param
  from ..testing import assert_array_almost_equal, assert_equal, assert_raises, assert_
  from ..random import random_tt, random_tr, random_tt_matrix
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_tt_to_tensor() without return types