code: def _gather(
      operand,
      start_indices,
      *,
      dimension_numbers,
      slice_sizes: core.Shape,
      indices_are_sorted,
      unique_indices,
      mode,
      fill_value,
      _in_avals: Sequence[core.ShapedArray],
      _out_aval: core.ShapedArray,
  ):
      """Tensorflow implementation of gather."""
      if mode == lax.GatherScatterMode.FILL_OR_DROP:
          gather_fill_fn = jax2tf._convert_jax_impl(
              lax_slicing._gather_fill, multiple_results=False
          )
          return gather_fill_fn(
              operand,
              start_indices,
              dimension_numbers=dimension_numbers,
              slice_sizes=slice_sizes,
              unique_indices=unique_indices,
              indices_are_sorted=indices_are_sorted,
              fill_value=fill_value,
              output_shape=_out_aval.shape,
              _in_avals=_in_avals,
              _out_aval=_out_aval,
          )
  
      # TODO(marcvanzee): Check if we need more tests in shape_poly for gather with
      # enable_xla=False.
      gather_args = GatherArgs(
          operand=operand,
          start_indices=start_indices,
          dnums=dimension_numbers,
          slice_sizes=slice_sizes,
          op_shape=_in_avals[0].shape,
          start_indices_shape=_in_avals[1].shape,
          out_aval=_out_aval,
      )
  
      errors = []
  
      for gather_fn in [
          _gather_for_scalar_indexing,
          _gather_for_multidim_indexing,
          _gather_with_batch_dim,
          _gather_with_batch_dims,
      ]:
          try:
              return gather_fn(gather_args)
          except ValueError as e:
              errors.append(f"{gather_fn}: {e!r}")
  
      error_msg = (
          f"Unsupported arguments for gather: {gather_args}, errors:\n"
          + "\n".join(errors)
      )
  
      raise _error("gather", error_msg)
  
imports: from __future__ import annotations
  import builtins
  from collections.abc import Sequence
  import dataclasses
  from functools import partial, wraps
  import math
  import string
  from typing import Any, Callable, Optional
  from jax._src import core
  from jax import lax
  from jax._src.lax import slicing
  from jax._src import dtypes
  from jax._src import util
  from jax.experimental.jax2tf import jax2tf
  import numpy
  import tensorflow
label_desc: Use image node_id 35 for calling a global function with example usage: _gather(operand, start_indices) and returns: gather_fill_fn, gather_fn