code: def test_validate_tt_rank():
      """Test for validate_tt_rank with random sizes"""
      tensor_shape = tuple(np.random.randint(5, 10, size=4))
      n_param_tensor = np.prod(tensor_shape)
      coef = 0.2
  
      # Rounding = floor
      rank = validate_tt_rank(tensor_shape, rank=coef, rounding="floor")
      n_param = _tt_n_param(tensor_shape, rank)
      assert_(n_param <= n_param_tensor * coef)
  
      # Rounding = ceil
      rank = validate_tt_rank(tensor_shape, rank=coef, rounding="ceil")
      n_param = _tt_n_param(tensor_shape, rank)
      assert_(n_param >= n_param_tensor * coef)
  
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 5 for calling a global function with example usage: test_validate_tt_rank() without return types