code: def test_consistency_loss(backend):
      NUM_SAMPLES = 100
      SIZE = 10
  
      z1 = np.random.randn(NUM_SAMPLES, SIZE)
      z2 = np.random.randn(NUM_SAMPLES, SIZE)
  
      if backend == "tensorflow":
          from alibi.explainers.backends.tensorflow.cfrl_tabular import (
              consistency_loss,
          )
          from alibi.explainers.backends.tensorflow.cfrl_base import (
              to_tensor,
              to_numpy,
          )
  
          device = None
      else:
          import torch
          from alibi.explainers.backends.pytorch.cfrl_tabular import (
              consistency_loss,
          )
          from alibi.explainers.backends.pytorch.cfrl_base import (
              to_tensor,
              to_numpy,
          )
  
          device = torch.device("cpu")
  
      z1_tensor, z2_tensor = to_tensor(z1, device=device), to_tensor(
          z2, device=device
      )
      closs_backend = consistency_loss(z1_tensor, z2_tensor)[
          "consistency_loss"
      ]
      closs_backend = to_numpy(closs_backend)
      closs = np.mean((z1 - z2) ** 2)
      assert np.isclose(closs, closs_backend)
  
imports: from typing import Union, List
  import pytest
  from pytest_lazyfixture import lazy_fixture
  import numpy
  from numpy.testing import assert_allclose
  import tensorflow
  import tensorflow.keras
  from alibi.explainers import CounterfactualRLTabular
  from alibi.explainers.backends.cfrl_base import get_hard_distribution
  from alibi.explainers.backends.cfrl_tabular import get_he_preprocessor, split_ohe, get_numerical_conditional_vector, get_categorical_conditional_vector, get_statistics, get_conditional_vector, sample
label_desc: Use image node_id 12 for calling a global function with example usage: test_consistency_loss(backend) without return types