code: def max_pool2d(
      x: paddle.Tensor,
      kernel: Union[int, Tuple[int, ...]],
      strides: Union[int, Tuple[int, ...]],
      padding: Union[str, int, Tuple[int], List[Tuple[int, int]]],
      /,
      *,
      data_format: str = "NHWC",
      dilation: Union[int, Tuple[int, ...]] = 1,
      ceil_mode: bool = False,
      out: Optional[paddle.Tensor] = None,
  ) -> paddle.Tensor:
      dims = 2
      kernel, strides, padding, dilation = _validate_max_pool_params(
          kernel,
          strides,
          padding,
          dilation,
          ceil_mode,
          dims,
          data_format,
      )
  
      if data_format == "NHWC":
          x = paddle.transpose(x, perm=[0, 3, 1, 2])
          kernel = (
              [kernel[i] for i in [0, 3, 1, 2]]
              if len(kernel) == (dims + 2)
              else kernel
          )
          strides = (
              [strides[i] for i in [0, 3, 1, 2]]
              if len(strides) == (dims + 2)
              else strides
          )
          padding = (
              [padding[i] for i in [0, 3, 1, 2]]
              if isinstance(padding, list)
              and len(padding) == (dims + 2)
              else padding
          )
  
      # Determine depthwise pooling
      x, kernel, strides, depth_pooling = _determine_depth_max_pooling(
          x, kernel, strides, dims, data_format="channel_first"
      )
  
      # TODO: Add support for pooling with dilation in the paddle backend.
      # It's currently not natively supported in the fromework.
      if max(dilation) > 1:
          raise NotImplementedError(
              "Max pooling with dilation is currently not supported in the 'paddle'"
              " backend"
          )
  
      padding = (
          [item for sublist in padding for item in sublist]
          if not isinstance(padding, str)
          else padding
      )  # paddle's expected format
      res = paddle.nn.functional.max_pool2d(
          x, kernel, strides, padding=padding, ceil_mode=ceil_mode
      )
  
      if depth_pooling:
          res = paddle.transpose(res, perm=[0, 2, 1, 3])
      if data_format == "NHWC":
          res = paddle.transpose(res, perm=[0, 2, 3, 1])
      return res
  
imports: from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
  import paddle
  from ivy.functional.ivy.layers import _handle_padding, _depth_max_pooling_helper, _validate_max_pool_params
  from ivy.utils.exceptions import IvyNotImplementedException, IvyValueError
  from ivy.func_wrapper import with_supported_device_and_dtypes, with_unsupported_dtypes, with_supported_dtypes
  from ..None import backend_version
  import ivy
label_desc: Use image node_id 3 for calling a global function with example usage: max_pool2d() and returns: res