code: def convolve(in1, in2, mode="full", method="auto"):
      """Convolve two N-dimensional arrays.
  
      Convolve ``in1`` and ``in2``, with the output size determined by the
      ``mode`` argument.
  
      Args:
          in1 (cupy.ndarray): First input.
          in2 (cupy.ndarray): Second input. Should have the same number of
              dimensions as `in1`.
          mode (str): Indicates the size of the output:
  
              - ``'full'``: output is the full discrete linear convolution \
                  (default)
              - ``'valid'``: output consists only of those elements that do \
                  not rely on the zero-padding. Either ``in1`` or ``in2`` must \
                  be at least as large as the other in every dimension.
              - ``'same'``: - output is the same size as ``in1``, centered with \
                  respect to the ``'full'`` output
  
          method (str): Indicates which method to use for the computations:
  
              - ``'direct'``: The convolution is determined directly from sums, \
                  the definition of convolution
              - ``'fft'``: The Fourier Transform is used to perform the \
                  convolution by calling ``fftconvolve``.
              - ``'auto'``: Automatically choose direct of FFT based on an \
                  estimate of which is faster for the arguments (default).
  
      Returns:
          cupy.ndarray: the result of convolution.
  
      .. seealso:: :func:`cupyx.scipy.signal.choose_conv_method`
      .. seealso:: :func:`cupyx.scipy.signal.correlation`
      .. seealso:: :func:`cupyx.scipy.signal.fftconvolve`
      .. seealso:: :func:`cupyx.scipy.signal.oaconvolve`
      .. seealso:: :func:`cupyx.scipy.ndimage.convolve`
      .. seealso:: :func:`scipy.signal.convolve`
      .. note::
          By default, ``convolve`` and ``correlate`` use ``method='auto'``, which
          calls ``choose_conv_method`` to choose the fastest method using
          pre-computed values. CuPy may not choose the same method to compute
          the convolution as SciPy does given the same inputs.
      """
      return _correlate(in1, in2, mode, method, True)
  
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 1 for calling a global function with example usage: convolve(in1, in2, mode, method) and returns: _correlate