code: def _get_grid_delta(coord_grid, dim):
      # Retrieves delta along given dimension, assuming the grid is uniform.
      delta = coord_grid[dim][..., 1] - coord_grid[dim][..., 0]
      n = len(coord_grid)
      if delta.shape.rank == 0:
          return delta
      else:  # Grid has a batch shape
          # Delta grid should broadcase with value grid
          # Shape batch_shape + n *[1]
          return delta[[...] + n * [tf.newaxis]]
  
imports: import tensorflow.compat.v2
  from tf_quant_finance import utils
label_desc: Use image node_id 14 for calling a global function with example usage: _get_grid_delta(coord_grid, dim) and returns: delta, delta