code: def test_unfolding_dot_khatri_rao(shape, rank):
      tensor = ivy.random_uniform(shape=shape)
      weights, factors = ivy.random_cp(
          shape, rank, full=False, normalise_factors=True
      )
  
      for mode in range(4):
          # Version forming explicitly the khatri-rao product
          unfolded = ivy.unfold(tensor, mode)
          kr_factors = ivy.khatri_rao(
              factors, weights=weights, skip_matrix=mode
          )
          true_res = ivy.matmul(unfolded, kr_factors)
  
          # Efficient sparse-safe version
          res = ivy.CPTensor.unfolding_dot_khatri_rao(
              tensor, (weights, factors), mode
          )
          assert np.allclose(true_res, res)
  
file_path: ivy/ivy_tests/test_ivy/test_misc/test_factorized_tensor/test_cp_tensor.py
imports: import ivy
  import numpy
  import pytest
label_desc: Use image node_id 10 for calling a global function with example usage: test_unfolding_dot_khatri_rao(shape, rank) without return types