code: def pad(
      input: np.ndarray,
      pad_width: Union[Iterable[Tuple[int]], int],
      /,
      *,
      mode: Union[
          Literal[
              "constant",
              "dilated",
              "edge",
              "linear_ramp",
              "maximum",
              "mean",
              "median",
              "minimum",
              "reflect",
              "symmetric",
              "wrap",
              "empty",
          ],
          Callable,
      ] = "constant",
      stat_length: Union[Iterable[Tuple[int]], int] = 1,
      constant_values: Union[Iterable[Tuple[Number]], Number] = 0,
      end_values: Union[Iterable[Tuple[Number]], Number] = 0,
      reflect_type: Literal["even", "odd"] = "even",
      **kwargs: Optional[Any],
  ) -> np.ndarray:
      if mode == "dilated":
          return _interior_pad(input, constant_values, pad_width)
      if callable(mode):
          return np.pad(
              _flat_array_to_1_dim_array(input),
              pad_width,
              mode=mode,
              **kwargs,
          )
      if mode in ["maximum", "mean", "median", "minimum"]:
          return np.pad(
              _flat_array_to_1_dim_array(input),
              pad_width,
              mode=mode,
              stat_length=stat_length,
          )
      elif mode == "constant":
          return np.pad(
              _flat_array_to_1_dim_array(input),
              pad_width,
              mode=mode,
              constant_values=constant_values,
          )
      elif mode == "linear_ramp":
          return np.pad(
              _flat_array_to_1_dim_array(input),
              pad_width,
              mode=mode,
              end_values=end_values,
          )
      elif mode in ["reflect", "symmetric"]:
          return np.pad(
              _flat_array_to_1_dim_array(input),
              pad_width,
              mode=mode,
              reflect_type=reflect_type,
          )
      else:
          return np.pad(
              _flat_array_to_1_dim_array(input),
              pad_width,
              mode=mode,
          )
  
imports: from typing import Iterable, Optional, Union, Sequence, Tuple, NamedTuple, Literal, Callable, Any, List
  from numbers import Number
  from collections import namedtuple
  import numpy
  import ivy
  from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
  from ivy.func_wrapper import with_supported_dtypes
  from .None import backend_version
label_desc: Use image node_id 13 for calling a global function with example usage: pad() and returns: _interior_pad, np, np, np, np, np, np