code: def convolve(a, v, mode="full"):
      """Returns the discrete, linear convolution of two one-dimensional sequences.
  
      Args:
          a (cupy.ndarray): first 1-dimensional input.
          v (cupy.ndarray): second 1-dimensional input.
          mode (str, optional): `valid`, `same`, `full`
  
      Returns:
          cupy.ndarray: Discrete, linear convolution of a and v.
  
      .. seealso:: :func:`numpy.convolve`
  
      """  # NOQA
      if a.size == 0:
          raise ValueError("a cannot be empty")
      if v.size == 0:
          raise ValueError("v cannot be empty")
      if v.ndim > 1:
          raise ValueError("v cannot be multidimensional array")
      if v.size > a.size:
          a, v = v, a
      a = a.ravel()
      v = v.ravel()
  
      method = _choose_conv_method(a, v, mode)
      if method == "direct":
          out = _dot_convolve(a, v, mode)
      elif method == "fft":
          out = _fft_convolve(a, v, mode)
      else:
          raise ValueError("Unsupported method")
      return out
  
file_path: cupy/cupy/_math/misc.py
imports: import cupy
  import cupyx.scipy.fft
  from cupy import _core
  from cupy._core import _routines_math
  from cupy._core import fusion
  from cupy.lib import stride_tricks
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: convolve(a, v, mode) and returns: out