code: def add_generic_rpn_outputs(model, blob_in, dim_in, spatial_scale_in):
      """Add RPN outputs (objectness classification and bounding box regression)
      to an RPN model. Abstracts away the use of FPN.
      """
      loss_gradients = None
      if cfg.FPN.FPN_ON:
          # Delegate to the FPN module
          FPN.add_fpn_rpn_outputs(
              model, blob_in, dim_in, spatial_scale_in
          )
          if cfg.MODEL.FASTER_RCNN:
              # CollectAndDistributeFpnRpnProposals also labels proposals when in
              # training mode
              model.CollectAndDistributeFpnRpnProposals()
          if model.train:
              loss_gradients = FPN.add_fpn_rpn_losses(model)
      else:
          # Not using FPN, add RPN to a single scale
          add_single_scale_rpn_outputs(
              model, blob_in, dim_in, spatial_scale_in
          )
          if model.train:
              loss_gradients = add_single_scale_rpn_losses(model)
      return loss_gradients
  
file_path: dense-pose/detectron/modeling/rpn_heads.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from detectron.core.config import cfg
  from detectron.modeling.generate_anchors import generate_anchors
  from detectron.utils.c2 import const_fill
  from detectron.utils.c2 import gauss_fill
  import detectron.modeling.FPN
  import detectron.utils.blob
label_desc: Use image node_id 1 for calling a global function with example usage: add_generic_rpn_outputs(model, blob_in, dim_in, spatial_scale_in) and returns: loss_gradients