code: def cityblock_batch(X: np.ndarray, y: np.ndarray) -> np.ndarray:
      """
      Calculate the L1 distances between a batch of arrays X and an array of the same shape y.
  
      Parameters
      ----------
      X
          Batch of arrays to calculate the distances from
      y
          Array to calculate the distance to
  
      Returns
      -------
      Array of distances from each array in X to y
  
      """
      X_dim = len(X.shape)
      y_dim = len(y.shape)
  
      if X_dim == y_dim:
          assert y.shape[0] == 1, "y must have batch size equal to 1"
      else:
          assert (
              X.shape[1:] == y.shape
          ), "X and y must have matching shapes"
  
      return (
          np.abs(X - y)
          .sum(axis=tuple(np.arange(1, X_dim)))
          .reshape(X.shape[0], -1)
      )
  
file_path: alibi-detect/alibi_detect/utils/distance.py
imports: import numpy
  from sklearn.manifold import MDS
  from typing import Any, Dict, Tuple
label_desc: Use image node_id 3 for calling a global function with example usage: cityblock_batch(X, y) and returns: np