code: def test_parafac2_init_cross_product():
      """Test that SVD initialization using the cross-product or concatenated
      tensor yields the same result."""
      rng = tl.check_random_state(1234)
      rank = 3
  
      random_parafac2_tensor = random_parafac2(
          shapes=[(25, 100)] * 3, rank=rank, random_state=rng
      )
      slices = parafac2_to_slices(random_parafac2_tensor)
  
      init = initialize_decomposition(slices, rank, init="svd")
  
      # Double the number of matrices so that we switch to the cross-product
      init_double = initialize_decomposition(
          slices + slices, rank, init="svd"
      )
  
      # These factor matrices should be essentially the same
      assert_allclose(
          init.factors[1], init_double.factors[1], rtol=1e-3, atol=1e-5
      )
      assert_allclose(
          init.factors[2], init_double.factors[2], rtol=1e-3, atol=1e-5
      )
  
file_path: tensorly/tensorly/decomposition/tests/test_parafac2.py
imports: import itertools
  import numpy
  import pytest
  import tensorly
  from ...random import random_parafac2
  from ...None import backend
  from ...testing import assert_, assert_class_wrapper_correctly_passes_arguments, assert_array_almost_equal, assert_allclose
  from .._parafac2 import Parafac2, parafac2, initialize_decomposition, _BroThesisLineSearch
  from ...parafac2_tensor import Parafac2Tensor, parafac2_to_tensor, parafac2_to_slices
  from ...metrics.factors import congruence_coefficient
label_desc: Use image node_id 8 for calling a global function with example usage: test_parafac2_init_cross_product() without return types