code: def test_validate_tr_tensor(true_shape, true_rank):
      factors = ivy.random_tr(true_shape, true_rank).factors
  
      # Check correct rank and shapes are returned
      shape, rank = ivy.TRTensor.validate_tr_tensor(factors)
      np.testing.assert_equal(
          shape,
          true_shape,
          err_msg=f"Returned incorrect shape (got {shape}, expected {true_shape})",
      )
      np.testing.assert_equal(
          rank,
          true_rank,
          err_msg=f"Returned incorrect rank (got {rank}, expected {true_rank})",
      )
  
      # One of the factors has the wrong ndim
      factors[0] = ivy.random_uniform(shape=(4, 4))
      with np.testing.assert_raises(ValueError):
          ivy.TRTensor.validate_tr_tensor(factors)
  
      # Consecutive factors ranks don't match
      factors[0] = ivy.random_uniform(shape=(3, 6, 4))
      with np.testing.assert_raises(ValueError):
          ivy.TRTensor.validate_tr_tensor(factors)
  
      # Boundary conditions not respected
      factors[0] = ivy.random_uniform(shape=(2, 6, 2))
      with np.testing.assert_raises(ValueError):
          ivy.TRTensor.validate_tr_tensor(factors)
  
imports: import ivy
  import numpy
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_validate_tr_tensor(true_shape, true_rank) without return types