code: def take(self, index, dimension=None):
      """Take entries of tensor along a dimension according to the index.
      This function is identical to torch.take() when dimension=None,
      otherwise, it is identical to ONNX gather() function.
      """
      result = self.shallow_copy()
      index = index.long()
      if dimension is None or self.dim() == 0:
          result._tensor = self._tensor.take(index)
      else:
          all_indices = [slice(0, x) for x in self.size()]
          all_indices[dimension] = index
          result._tensor = self._tensor[all_indices]
      return result
  
imports: import torch
  from ..common.tensor_types import is_tensor
  from ..common.util import torch_cat, torch_stack
label_desc: Use image node_id 8 for calling a global function with example usage: take(index, dimension) and returns: result