code: def test_parafac2_slice_and_tensor_input():
      rng = tl.check_random_state(1234)
      rank = 3
  
      random_parafac2_tensor = random_parafac2(
          shapes=[(15, 30) for _ in range(25)],
          rank=rank,
          random_state=rng,
      )
      tensor = parafac2_to_tensor(random_parafac2_tensor)
      slices = parafac2_to_slices(random_parafac2_tensor)
  
      slice_rec = parafac2(
          slices,
          rank,
          init="svd",
          normalize_factors=False,
          n_iter_max=2,
      )
      slice_rec_tensor = parafac2_to_tensor(slice_rec)
  
      tensor_rec = parafac2(
          tensor,
          rank,
          init="svd",
          normalize_factors=False,
          n_iter_max=2,
      )
      tensor_rec_tensor = parafac2_to_tensor(tensor_rec)
  
      assert_array_almost_equal(slice_rec_tensor, tensor_rec_tensor)
  
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 5 for calling a global function with example usage: test_parafac2_slice_and_tensor_input() without return types