code: def test_cp_flip_sign(shape, rank):
      cp_tensor = ivy.random_cp(shape, rank)
      weights, factors = ivy.CPTensor.cp_flip_sign(cp_tensor)
  
      assert ivy.all(ivy.mean(factors[1], axis=0) > 0)
      assert ivy.all(ivy.mean(factors[2], axis=0) > 0)
      assert cp_tensor.rank == cp_tensor.rank
      assert np.allclose(cp_tensor.weights, weights)
      assert np.allclose(
          ivy.CPTensor.cp_to_tensor((weights, factors)),
          ivy.CPTensor.cp_to_tensor(cp_tensor),
      )
  
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 1 for calling a global function with example usage: test_cp_flip_sign(shape, rank) without return types