code: def get_at_index(
      tokens: torch.Tensor, index: torch.Tensor
  ) -> torch.Tensor:
      """Selects tokens at index.
  
      Args:
          tokens:
              Token tensor with shape (batch_size, sequence_length, dim).
          index:
              Index tensor with shape (batch_size, index_length) where each entry is
              an index in [0, sequence_length).
  
      Returns:
          Token tensor with shape (batch_size, index_length, dim) containing the
          selected tokens.
  
      """
      index = expand_index_like(index, tokens)
      return torch.gather(tokens, 1, index)
  
imports: import math
  import warnings
  from typing import Iterable, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.distributed
  import torch.nn
  from numpy.typing import NDArray
  from torch.nn import Module
  from torch.nn.modules.batchnorm import _BatchNorm
  from torch.nn.parameter import Parameter
label_desc: Use image node_id 13 for calling a global function with example usage: get_at_index(tokens, index) and returns: torch