code: def pad(
      input: paddle.Tensor,
      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],
  ) -> paddle.Tensor:
      constant_values = (
          float(constant_values)
          if not isinstance(constant_values, float)
          else constant_values
      )
      pad_width = _to_paddle_padding(pad_width, input.ndim)
      mode = (
          "replicate"
          if mode == "edge"
          else "circular"
          if mode == "wrap"
          else mode
      )
      data_format = (
          "NCL"
          if input.ndim == 1
          else "NCHW"
          if input.ndim == 2
          else "NCDHW"
      )
      return (
          paddle.nn.functional.pad(
              input.unsqueeze(0).unsqueeze(0),
              pad_width,
              mode=mode,
              value=constant_values,
              data_format=data_format,
          )
          .squeeze(0)
          .squeeze(0)
      )
  
imports: from collections import namedtuple
  from typing import Iterable, Optional, Union, Sequence, Tuple, NamedTuple, List, Any, Literal, Callable
  from numbers import Number
  from ..None import backend_version
  from ivy.func_wrapper import with_supported_device_and_dtypes, with_unsupported_device_and_dtypes, with_supported_dtypes, with_unsupported_dtypes
  import paddle
  import ivy
  import ivy.functional.backends.paddle
  from ivy.functional.ivy.experimental.manipulation import _check_paddle_pad, _to_paddle_padding
label_desc: Use image node_id 2 for calling a global function with example usage: pad() and returns: paddle