code: def top_k(
      x: paddle.Tensor,
      k: int,
      /,
      *,
      axis: int = -1,
      largest: Optional[bool] = True,
      sorted: bool = True,
      out: Optional[Tuple[paddle.Tensor, paddle.Tensor]] = None,
  ) -> Tuple[paddle.Tensor, paddle.Tensor]:
      k = min(k, x.shape[axis])
      topk_res = NamedTuple(
          "top_k",
          [("values", paddle.Tensor), ("indices", paddle.Tensor)],
      )
      with ivy.ArrayMode(False):
          indices = ivy.argsort(x, axis=axis, descending=largest)
          indices = paddle.index_select(
              indices, paddle.arange(end=k), axis
          )
          if not sorted:
              indices = paddle.sort(indices, axis=axis)
          val = ivy.take_along_axis(x, indices, axis)
          return topk_res(val, indices)
  
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 8 for calling a global function with example usage: top_k() and returns: topk_res