code: def gather_nd(
      params: torch.Tensor,
      indices: torch.Tensor,
      /,
      *,
      batch_dims: int = 0,
      out: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      ivy.utils.assertions.check_gather_nd_input_valid(
          params, indices, batch_dims
      )
      batch_dims %= len(params.shape)
      result = []
      if batch_dims == 0:
          result = gather_nd_helper(params, indices)
      else:
          for b in range(batch_dims):
              if b == 0:
                  zip_list = [(p, i) for p, i in zip(params, indices)]
              else:
                  zip_list = [
                      (p, i)
                      for z in [zip(p1, i1) for p1, i1 in zip_list]
                      for p, i in z
                  ]
          for z in zip_list:
              p, i = z
              r = gather_nd_helper(p, i)
              result.append(r)
          result = torch.stack(result)
          result = result.reshape(
              [*params.shape[0:batch_dims], *result.shape[1:]]
          )
      return result
  
imports: from functools import reduce
  from numbers import Number
  from operator import mul
  from typing import Optional, Union, Sequence, Callable, List, Tuple
  import numpy
  import torch
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, _update_torch_views
  from .None import backend_version, is_variable
  from ...ivy.general import _broadcast_to
label_desc: Use image node_id 14 for calling a global function with example usage: gather_nd() and returns: result