code: def gather(value, index, dim):
      """
      Broadcasted gather of indexed values along a named dim.
      """
      value, index = broadcast_all(value, index)
      with ignore_jit_warnings():
          zero = torch.zeros(1, dtype=torch.long, device=index.device)
      index = index.index_select(dim, zero)
      return value.gather(dim, index)
  
imports: import copy
  import ctypes
  import functools
  import numbers
  import weakref
  from contextlib import contextmanager
  import torch
  import torch.distributions
  from torch import logsumexp
  from torch.distributions.utils import broadcast_all
  from pyro.util import ignore_jit_warnings
  from ..None import settings
label_desc: Use image node_id 8 for calling a global function with example usage: gather(value, index, dim) and returns: value