code: def infer_interval_breaks(coord, axis=0):
      """
      >>> infer_interval_breaks(np.arange(5))
      array([-0.5,  0.5,  1.5,  2.5,  3.5,  4.5])
      >>> infer_interval_breaks([[0, 1], [3, 4]], axis=1)
      array([[-0.5,  0.5,  1.5],
             [ 2.5,  3.5,  4.5]])
      """
      if cupy and isinstance(coord, cupy.ndarray):
          # leave cupy array as-is
          pass
      else:
          coord = np.asarray(coord)
      if len(coord) == 0:
          return np.array([], dtype=coord.dtype)
      deltas = 0.5 * np.diff(coord, axis=axis)
      first = np.take(coord, [0], axis=axis) - np.take(
          deltas, [0], axis=axis
      )
      last = np.take(coord, [-1], axis=axis) + np.take(
          deltas, [-1], axis=axis
      )
      trim_last = tuple(
          slice(None, -1) if n == axis else slice(None)
          for n in range(coord.ndim)
      )
      return np.concatenate(
          [first, coord[trim_last] + deltas, last], axis=axis
      )
  
imports: from __future__ import annotations
  from itertools import groupby
  from math import floor, ceil
  import dask.array
  import numpy
  from dask.delayed import delayed
  from numba import prange
  from .utils import ngjit, ngjit_parallel
label_desc: Use image node_id 20 for calling a global function with example usage: infer_interval_breaks(coord, axis) and returns: np, np