code: def convolve(
      in1: Array,
      in2: Array,
      mode: str = "full",
      method: str = "auto",
      precision: PrecisionLike = None,
  ) -> Array:
      if method == "fft":
          return fftconvolve(in1, in2, mode=mode)
      elif method in ["direct", "auto"]:
          return _convolve_nd(in1, in2, mode, precision=precision)
      else:
          raise ValueError(
              f"Got {method=}; expected 'auto', 'fft', or 'direct'."
          )
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  from functools import partial
  import math
  import operator
  from typing import Callable
  import warnings
  import numpy
  import scipy.signal
  from scipy.fft import next_fast_len
  import jax
  import jax.numpy.fft
  import jax.numpy
  from jax import lax
  from jax._src.api_util import _ensure_index_tuple
  from jax._src import dtypes
  from jax._src.lax.lax import PrecisionLike
  from jax._src.numpy import linalg
  from jax._src.numpy.util import check_arraylike, _wraps, promote_dtypes_inexact, promote_dtypes_complex
  from jax._src.third_party.scipy import signal_helper
  from jax._src.typing import Array, ArrayLike
  from jax._src.util import canonicalize_axis, tuple_delete, tuple_insert
label_desc: Use image node_id 4 for calling a global function with example usage: convolve(in1, in2, mode, method, precision) and returns: fftconvolve, _convolve_nd