code: def test_parafac2_init_valid():
      rng = tl.check_random_state(1234)
      rank = 3
  
      random_parafac2_tensor = random_parafac2(
          shapes=[(15, 30)] * 25, rank=rank, random_state=rng
      )
      tensor = parafac2_to_tensor(random_parafac2_tensor)
      weights, (A, B, C), projections = random_parafac2_tensor
      B = T.dot(projections[0], B)
  
      for init_method in [
          "random",
          "svd",
          random_parafac2_tensor,
          (weights, (A, B, C)),
      ]:
          init = initialize_decomposition(
              tensor, rank, init=init_method
          )
          assert init.shape == random_parafac2_tensor.shape
  
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 7 for calling a global function with example usage: test_parafac2_init_valid() without return types