code: def test_validate_tr_rank():
      """Test for validate_tr_rank with random sizes"""
      tensor_shape = tuple(np.random.randint(1, 100, size=4))
      n_param_tensor = np.prod(tensor_shape)
  
      # Rounding = floor
      rank = validate_tr_rank(
          tensor_shape, rank="same", rounding="floor"
      )
      n_param = _tr_n_param(tensor_shape, rank)
      assert_(n_param <= n_param_tensor)
  
      # Rounding = ceil
      rank = validate_tr_rank(
          tensor_shape, rank="same", rounding="ceil"
      )
      n_param = _tr_n_param(tensor_shape, rank)
      assert_(n_param >= n_param_tensor)
  
      # Integer rank
      with assert_raises(ValueError):
          validate_tr_rank(tensor_shape, rank=(2, 3, 4, 2))
  
      with assert_raises(ValueError):
          validate_tr_rank(tensor_shape, rank=(2, 3, 4, 2, 3))
  
imports: import numpy
  import tensorly
  from ..random import random_tr
  from ..testing import assert_allclose, assert_equal, assert_raises, assert_
  from ..tr_tensor import tr_to_tensor, _validate_tr_tensor, _tr_n_param, validate_tr_rank
label_desc: Use image node_id 3 for calling a global function with example usage: test_validate_tr_rank() without return types