code: def test_cp_to_unfolded(shapeU1, shapeU2, shapeU3, shapeU4):
      U1 = ivy.reshape(ivy.arange(1, 10, dtype=float), shapeU1)
      U2 = ivy.reshape(ivy.arange(10, 22, dtype=float), shapeU2)
      U3 = ivy.reshape(ivy.arange(22, 28, dtype=float), shapeU3)
      U4 = ivy.reshape(ivy.arange(28, 34, dtype=float), shapeU4)
      U = [ivy.array(t) for t in [U1, U2, U3, U4]]
      cp_tensor = ivy.CPTensor((ivy.ones((3,)), U))
  
      full_tensor = ivy.CPTensor.cp_to_tensor(cp_tensor)
      for mode in range(4):
          true_res = ivy.unfold(full_tensor, mode)
          res = ivy.CPTensor.cp_to_unfolded(cp_tensor, 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 8 for calling a global function with example usage: test_cp_to_unfolded(shapeU1, shapeU2, shapeU3, shapeU4) without return types