code: def test_initialize_nn_cp():
      """Test that if we initialise with an existing init, then it isn't modified."""
      init = CPTensor(
          [
              None,
              [-tl.ones((30, 3)), -tl.ones((20, 3)), -tl.ones((10, 3))],
          ]
      )
      tensor = cp_to_tensor(init)
      initialised_tensor = initialize_cp(
          tensor, 3, init=init, non_negative=True
      )
      for factor_matrix, init_factor_matrix in zip(
          init[1], initialised_tensor[1]
      ):
          assert_array_equal(factor_matrix, init_factor_matrix)
      assert_array_equal(tensor, cp_to_tensor(initialised_tensor))
  
imports: import numpy
  import pytest
  import tensorly
  from .._cp import parafac, initialize_cp, sample_khatri_rao, randomised_parafac, CP, RandomizedCP, CPTensor
  from .._nn_cp import non_negative_parafac, non_negative_parafac_hals, CP_NN, CP_NN_HALS
  from ...cp_tensor import cp_to_tensor
  from ...cp_tensor import cp_to_tensor
  from ...random import random_cp
  from ...tenalg import khatri_rao
  from ...None import backend
  from ...testing import assert_array_equal, assert_, assert_class_wrapper_correctly_passes_arguments, assert_array_almost_equal
  from ...metrics.factors import congruence_coefficient
label_desc: Use image node_id 5 for calling a global function with example usage: test_initialize_nn_cp() without return types