code: def median(
      input: paddle.Tensor,
      /,
      *,
      axis: Optional[Union[Tuple[int], int]] = None,
      keepdims: Optional[bool] = False,
      out: Optional[paddle.Tensor] = None,
  ) -> paddle.Tensor:
      if paddle.is_complex(input):
          ret = paddle.complex(
              paddle.median(input.real(), axis=axis, keepdim=True),
              paddle.median(input.imag(), axis=axis, keepdim=True),
          )
      else:
          ret = paddle.median(input, axis=axis, keepdim=True)
      # keepdims is set to True because in versions up to 2.5.2
      # there was a problem when the axis was defined, and it was the
      # only axis in the tensor, so it needs to be handled manually
      if not keepdims:
          ret = paddle_backend.squeeze(ret, axis=axis)
      # The following code is to simulate other frameworks
      # output shapes behaviour since min output dim is 1 in paddle
      if isinstance(axis, Sequence):
          if len(axis) == input.ndim:
              axis = None
      if (input.ndim == 1 or axis is None) and not keepdims:
          ret = ret.squeeze()
      return ret.astype(input.dtype)
  
imports: from typing import Optional, Union, Tuple, Sequence, Any
  import paddle
  import ivy.functional.backends.paddle
  import ivy
  from copy import deepcopy
  from ivy.func_wrapper import with_unsupported_device_and_dtypes, with_supported_dtypes
  from .None import backend_version
label_desc: Use image node_id 1 for calling a global function with example usage: median() and returns: ret