code: def _take_with_axis(
      x: torch.Tensor, indices: torch.Tensor, /, *, axis: int, mode: str
  ) -> torch.Tensor:
      # has no checks
      # default behaviour is 'raise' like ON CPU
      # additional check is recommended
  
      x_shape = x.shape[axis]
      if not ivy.exists(axis):
          x = x.flatten()
          x_shape = torch.prod(torch.tensor(x_shape))
      else:
          x_shape = x.shape[axis]
  
      # wrap
      if mode == "wrap":
          indices = ((indices % x_shape) + x_shape) % x_shape
      # clip
      else:
          indices = torch.clip(indices, 0, x_shape - 1)
  
      rank = len(x.shape)
      axis = ((axis % rank) + rank) % rank
      slicer = ([slice(None)] * axis) + [indices]
      slicer = tuple(slicer)
  
      return x[slicer]
  
imports: from typing import Iterable, Optional, Union, Sequence, Tuple, NamedTuple, List, Literal, Callable, Any
  from numbers import Number
  from collections import namedtuple
  import torch
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from ..None import backend_version
  import ivy
  from ivy.functional.ivy.experimental.manipulation import _to_tf_padding, _check_paddle_pad, _to_paddle_padding
label_desc: Use image node_id 27 for calling a global function with example usage: _take_with_axis() and returns: x