code: def intervals_to_durations(intervals):
      
      validate_intervals(intervals)
      return np.abs(np.diff(intervals, axis=-1)).flatten()
docs: Converts an array of n intervals to their n durations.
  
      Parameters
      ----------
      intervals : np.ndarray, shape=(n, 2)
          An array of time intervals, as returned by
          :func:`mir_eval.io.load_intervals()`.
          The ``i`` th interval spans time ``intervals[i, 0]`` to
          ``intervals[i, 1]``.
  
      Returns
      -------
      durations : np.ndarray, shape=(n,)
          Array of the duration of each interval.