code: def generate_anchors_reference(
      ratios, scales, num_anchors, feature_map_shape
  ):
      """
      Generate the default anchor for one feat map which we will later convolve
      to generate all the anchors of that feat map.
      """
      heights = np.zeros(num_anchors)
      widths = np.zeros(num_anchors)
  
      if len(scales) > 1:
          widths[0] = heights[0] = (
              np.sqrt(scales[0] * scales[1]) * feature_map_shape[0]
          )
      # The last endpoint
      else:
          # The last layer doesn't have a subsequent layer with which
          # to generate the second scale from their geometric mean,
          # so we hard code it to 0.99.
          # We should add this parameter to the config eventually.
          heights[0] = scales[0] * feature_map_shape[0] * 0.99
          widths[0] = scales[0] * feature_map_shape[1] * 0.99
  
      ratios = ratios[: num_anchors - 1]
      heights[1:] = scales[0] / np.sqrt(ratios) * feature_map_shape[0]
      widths[1:] = scales[0] * np.sqrt(ratios) * feature_map_shape[1]
  
      # Each feature layer forms a grid on image space, so we
      # calculate the center point on the first cell of this grid.
      # Which we'll use as the center for our anchor reference.
      # The center will be the midpoint of the top left cell,
      # given that each cell is of 1x1 size, its center will be 0.5x0.5
      x_center = y_center = 0.5
  
      # Create anchor reference.
      anchors = np.column_stack(
          [
              x_center - widths / 2,
              y_center - heights / 2,
              x_center + widths / 2,
              y_center + heights / 2,
          ]
      )
  
      return anchors
  
imports: import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: generate_anchors_reference(ratios, scales, num_anchors, feature_map_shape) and returns: anchors