code: def test_tensor_train_tensorly_2(shape, rank):
      tensor = ivy.random_uniform(shape=shape)
      factors = ivy.tensor_train(tensor, rank)
  
      for k in range(6):
          (r_prev, n_k, r_k) = factors[k].shape
  
          first_error_message = (
              "TT rank "
              + str(k)
              + " is greater than the maximum allowed "
          )
          first_error_message += str(r_prev) + " > " + str(rank[k])
          assert r_prev <= rank[k], first_error_message
  
          first_error_message = (
              "TT rank "
              + str(k + 1)
              + " is greater than the maximum allowed "
          )
          first_error_message += str(r_k) + " > " + str(rank[k + 1])
          assert r_k <= rank[k + 1], first_error_message
  
imports: import math
  from hypothesis import strategies
  from hypothesis import assume
  import numpy
  import pytest
  import itertools
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_test, BackendHandler
  import ivy
label_desc: Use image node_id 53 for calling a global function with example usage: test_tensor_train_tensorly_2(shape, rank) without return types