code: def histogram(input, min, max, bins, labels=None, index=None):
      """Calculate the histogram of the values of an array, optionally at labels.
  
      Histogram calculates the frequency of values in an array within bins
      determined by `min`, `max`, and `bins`. The `labels` and `index`
      keywords can limit the scope of the histogram to specified sub-regions
      within the array.
  
      Args:
          input (cupy.ndarray): Data for which to calculate histogram.
          min (int): Minimum values of range of histogram bins.
          max (int): Maximum values of range of histogram bins.
          bins (int): Number of bins.
          labels (cupy.ndarray, optional): Labels for objects in `input`. If not
              None, must be same shape as `input`.
          index (int or sequence of ints, optional): Label or labels for which to
              calculate histogram. If None, all values where label is greater
              than zero are used.
  
      Returns:
          cupy.ndarray: Histogram counts.
  
      .. seealso:: :func:`scipy.ndimage.histogram`
      """
      _bins = cupy.linspace(min, max, bins + 1)
  
      def _hist(vals):
          return cupy.histogram(vals, _bins)[0]
  
      return labeled_comprehension(
          input,
          labels,
          index,
          _hist,
          object,
          None,
          pass_positions=False,
      )
  
imports: import warnings
  import numpy
  import cupy
  from cupy import _core
  from cupy import _util
label_desc: Use image node_id 30 for calling a global function with example usage: histogram(input, min, max, bins, labels, index) and returns: labeled_comprehension, cupy