code: def test_cp_mode_dot(shape, rank):
      cp_ten = ivy.random_cp(shape, rank, orthogonal=True, full=False)
      full_tensor = ivy.CPTensor.cp_to_tensor(cp_ten)
      # matrix for mode 1
      matrix = ivy.random_uniform(shape=(7, shape[1]))
      # vec for mode 2
      vec = ivy.random_uniform(shape=shape[2])
  
      # Test cp_mode_dot with matrix
      res = ivy.CPTensor.cp_mode_dot(cp_ten, matrix, mode=1, copy=True)
      # Note that if copy=True is not respected, factors will be changes
      # And the next test will fail
      res = ivy.CPTensor.cp_to_tensor(res)
      true_res = ivy.mode_dot(full_tensor, matrix, mode=1)
      assert np.allclose(true_res, res, atol=1e-3, rtol=1e-3)
  
      # Check that the data was indeed copied
      rec = ivy.CPTensor.cp_to_tensor(cp_ten)
      assert np.allclose(full_tensor, rec)
  
      # Test cp_mode_dot with vec
      res = ivy.CPTensor.cp_mode_dot(cp_ten, vec, mode=2, copy=True)
      res = ivy.CPTensor.cp_to_tensor(res)
      true_res = ivy.mode_dot(full_tensor, vec, mode=2)
      assert res.shape == true_res.shape
      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 3 for calling a global function with example usage: test_cp_mode_dot(shape, rank) without return types