code: def _get_mask(x, indices):
      # create a boolean mask from subsample indices:
      #   + start with a zero tensor
      #   + at a specific `dim`, we increase by 1
      #     all entries which have index at `dim`
      #     belong to `indices[dim]`
      #   + at the end, we will get a tensor whose
      #     values at `indices` are `len(indices)`
      mask = x.new_zeros(x.shape, dtype=torch.long, device=x.device)
      if len(indices) > 0:
          idx = []
          for dim in range(-x.dim(), 0):
              if dim in indices:
                  mask[idx + [indices[dim]]] += 1
              idx.append(slice(None))
      return mask == len(indices)
  
file_path: pyro/pyro/optim/dct_adam.py
imports: import math
  from typing import Callable, Dict, Optional, Tuple
  import torch
  from torch.nn.functional import pad
  from torch.optim.optimizer import Optimizer
  from pyro.ops.tensor_utils import dct, idct, next_fast_len
label_desc: Use image node_id 3 for calling a global function with example usage: _get_mask(x, indices) and returns: unknown