code: def assert_segmentations(
      x_batch: np.array, s_batch: np.array
  ) -> None:
      """
      Asserts on segmentations, assumes channel first layout.
  
      Parameters
      ----------
      x_batch: np.ndarray
           The batch of input to compare the shape of the attributions with.
      s_batch: np.ndarray
           The batch of segmentations.
  
      Returns
      -------
      None
      """
      assert (
          type(s_batch) == np.ndarray
      ), "Segmentations 's_batch' should be of type np.ndarray."
      assert (
          np.shape(x_batch)[0] == np.shape(s_batch)[0]
      ), "The inputs 'x_batch' and segmentations 's_batch' should include the same number of samples."
      assert (
          np.shape(x_batch)[2:] == np.shape(s_batch)[2:]
      ), "The inputs 'x_batch' and segmentations 's_batch' should share the same dimensions."
      assert (
          np.shape(s_batch)[1] == 1
      ), "The second dimension of the segmentations 's_batch' should be equal to 1."
      assert (
          len(np.nonzero(s_batch)) > 0
      ), "The segmentation 's_batch' must contain non-zero elements."
      assert (
          np.isin(s_batch.flatten(), [0, 1]).all()
          or np.isin(s_batch.flatten(), [True, False]).all()
      ), "The segmentation 's_batch' should contain only [1, 0] or [True, False]."
  
file_path: Quantus/quantus/helpers/asserts.py
imports: from typing import Callable, Tuple, Sequence, Union
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: assert_segmentations(x_batch, s_batch) without return types