code: def correlation_lags(in1_len, in2_len, mode="full"):
      r"""
      Calculates the lag / displacement indices array for 1D cross-correlation.
  
      Parameters
      ----------
      in1_len : int
          First input size.
      in2_len : int
          Second input size.
      mode : str {'full', 'valid', 'same'}, optional
          A string indicating the size of the output.
          See the documentation `correlate` for more information.
  
      Returns
      -------
      lags : array
          Returns an array containing cross-correlation lag/displacement indices.
          Indices can be indexed with the np.argmax of the correlation to return
          the lag/displacement.
  
      See Also
      --------
      correlate : Compute the N-dimensional cross-correlation.
      scipy.signal.correlation_lags
      """
      # calculate lag ranges in different modes of operation
      if mode == "full":
          # the output is the full discrete linear convolution
          # of the inputs. (Default)
          lags = cupy.arange(-in2_len + 1, in1_len)
      elif mode == "same":
          # the output is the same size as `in1`, centered
          # with respect to the 'full' output.
          # calculate the full output
          lags = cupy.arange(-in2_len + 1, in1_len)
          # determine the midpoint in the full output
          mid = lags.size // 2
          # determine lag_bound to be used with respect
          # to the midpoint
          lag_bound = in1_len // 2
          # calculate lag ranges for even and odd scenarios
          if in1_len % 2 == 0:
              lags = lags[(mid - lag_bound) : (mid + lag_bound)]
          else:
              lags = lags[(mid - lag_bound) : (mid + lag_bound) + 1]
      elif mode == "valid":
          # the output consists only of those elements that do not
          # rely on the zero-padding. In 'valid' mode, either `in1` or `in2`
          # must be at least as large as the other in every dimension.
  
          # the lag_bound will be either negative or positive
          # this let's us infer how to present the lag range
          lag_bound = in1_len - in2_len
          if lag_bound >= 0:
              lags = cupy.arange(lag_bound + 1)
          else:
              lags = cupy.arange(lag_bound, 1)
      return lags
  
imports: import warnings
  import cupy
  from cupy._core import internal
  from cupy.linalg import lstsq
  import cupyx.scipy.fft
  from cupyx.scipy.ndimage import _util
  from cupyx.scipy.ndimage import _filters
  from cupyx.scipy.signal import _signaltools_core
  from cupyx.scipy.signal._arraytools import const_ext, even_ext, odd_ext, axis_reverse, axis_slice, axis_assign
  from cupyx.scipy.signal._iir_utils import apply_iir, apply_iir_sos, compute_correction_factors, compute_correction_factors_sos
label_desc: Use image node_id 10 for calling a global function with example usage: correlation_lags(in1_len, in2_len, mode) and returns: lags