code: def _correlate2d(
      in1, in2, mode, boundary, fillvalue, convolution=False
  ):
      if not (in1.ndim == in2.ndim == 2):
          raise ValueError(
              "{} inputs must both be 2-D arrays".format(
                  "convolve2d" if convolution else "correlate2d"
              )
          )
      _boundaries = {
          "fill": "constant",
          "pad": "constant",
          "wrap": "wrap",
          "circular": "wrap",
          "symm": "reflect",
          "symmetric": "reflect",
      }
      boundary = _boundaries.get(boundary)
      if boundary is None:
          raise ValueError(
              'Acceptable boundary flags are "fill" (or "pad"), '
              '"circular" (or "wrap"), and '
              '"symmetric" (or "symm").'
          )
      quick_out = _st_core._check_conv_inputs(
          in1, in2, mode, convolution
      )
      if quick_out is not None:
          return quick_out
      return _st_core._direct_correlate(
          in1,
          in2,
          mode,
          in1.dtype,
          convolution,
          boundary,
          fillvalue,
          not convolution,
      )
  
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 9 for calling a global function with example usage: _correlate2d(in1, in2, mode, boundary, fillvalue, convolution) and returns: _st_core, quick_out