code: def test_l1_loss(reduction, backend):
      NUM_SAMPLES = 100
      SIZE = 10
  
      # generate random tensors
      y1 = np.random.randn(NUM_SAMPLES, SIZE)
      y2 = np.random.randn(NUM_SAMPLES, SIZE)
  
      if backend == "tensorflow":
          from alibi.explainers.backends.tensorflow.cfrl_tabular import (
              l1_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 (
              l1_loss,
          )
          from alibi.explainers.backends.pytorch.cfrl_base import (
              to_tensor,
              to_numpy,
          )
  
          device = torch.device("cpu")
  
      y1_tensor, y2_tensor = to_tensor(y1, device=device), to_tensor(
          y2, device=device
      )
      l1_backend = l1_loss(y1_tensor, y2_tensor, reduction=reduction)
      l1_backend = to_numpy(l1_backend)
      l1 = np.abs(y1 - y2)
  
      if reduction == "none":
          assert_allclose(l1, l1_backend)
      elif reduction == "sum":
          assert np.isclose(np.sum(l1), l1_backend)
      else:
          assert np.isclose(np.mean(l1), l1_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 11 for calling a global function with example usage: test_l1_loss(reduction, backend) without return types