code: def crop_idx(total_size, crop_size, crop_loc, crop_grid):
      if isinstance(total_size, int):
          total_size = (total_size, total_size)
      if isinstance(crop_size, int):
          crop_size = (crop_size, crop_size)
      if crop_loc > -1:
          row_loc = crop_loc // crop_grid[0]
          col_loc = crop_loc % crop_grid[1]
          row_start = row_loc * (total_size[0] - crop_size[0]) // 2
          col_start = col_loc * (total_size[1] - crop_size[1]) // 2
      else:
          row_start = np.random.randint(
              0, total_size[0] - crop_size[0], 1
          )[0]
          col_start = np.random.randint(
              0, total_size[1] - crop_size[1], 1
          )[0]
      return row_start, col_start
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import warnings
  from contextlib import contextmanager
  from .version_utils import tf_later_than
label_desc: Use image node_id 15 for calling a global function with example usage: crop_idx(total_size, crop_size, crop_loc, crop_grid) and returns: row_start,  col_start