code: def test_congruence_coefficient(I, R, absolute_value):
      rng = tl.check_random_state(1234)
      A = tl.tensor(rng.standard_normal((I, R)))
      B = tl.tensor(rng.standard_normal((I, R)))
  
      fast_congruence, fast_permutation = congruence_coefficient(
          A, B, absolute_value=absolute_value
      )
      slow_congruence, slow_permutation = _congruence_coefficient_slow(
          A, B, absolute_value=absolute_value
      )
      assert fast_congruence == pytest.approx(slow_congruence)
      if I != 1:
          assert fast_permutation == list(slow_permutation)
  
      # Adding test from @maximeguillaud issue #487
      shape = (3, 4, 5)
      rank = 4
      cp_tensor_1 = random_cp(shape, rank, random_state=0)
      cp_tensor_2 = cp_tensor_1.cp_copy()
      col_order_2 = [3, 1, 2, 0]
      for f in range(3):
          cp_tensor_2.factors[f] = cp_tensor_1.factors[f][
              :, col_order_2
          ] * (-1) ** (f + 1)
      _, permutation = cp_permute_factors(cp_tensor_1, cp_tensor_2)
  
      assert permutation[0].tolist() == col_order_2
  
file_path: tensorly/tensorly/metrics/tests/test_factors.py
imports: import itertools
  import pytest
  import tensorly
  from ..factors import congruence_coefficient
  from tensorly.random import random_cp
  from tensorly.cp_tensor import cp_permute_factors
label_desc: Use image node_id 3 for calling a global function with example usage: test_congruence_coefficient(I, R, absolute_value) without return types