code: def gather_nd(params, indices):
      """
      Args:
          params: Tensor to index
          indices: k-dimension tensor of integers.
      Returns:
          output: 1-dimensional tensor of elements of ``params``, where
              output[i] = params[i][indices[i]]
  
              params   indices   output
  
              1 2       1 1       4
              3 4       2 0 ----> 5
              5 6       0 0       1
      """
      max_value = (
          functools.reduce(operator.mul, list(params.size())) - 1
      )
      indices = indices.t().long()
      ndim = indices.size(0)
      idx = torch.zeros_like(indices[0]).long()
      m = 1
  
      for i in range(ndim)[::-1]:
          idx += indices[i] * m
          m *= params.size(i)
  
      idx[idx < 0] = 0
      idx[idx > max_value] = 0
      return torch.take(params, idx)
  
file_path: attributionpriors/attributionpriors/pytorch_ops_cpu.py
imports: import functools
  import operator
  import torch
  from torch.autograd import grad
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 for calling a global function with example usage: gather_nd(params, indices) and returns: torch