code: def create_proposal_layer(
      rpn_cls_prob_reshape,
      rpn_bbox_pred,
      im_info,
      cfg,
      use_native_proposal_layer=False,
  ):
      layer_config = {}
      layer_config["feat_stride"] = cfg["MODEL"].FEATURE_STRIDE
      layer_config["scales"] = cfg["DATA"].PROPOSAL_LAYER_SCALES
  
      layer_config["train_pre_nms_topN"] = cfg[
          "TRAIN"
      ].RPN_PRE_NMS_TOP_N
      layer_config["train_post_nms_topN"] = cfg[
          "TRAIN"
      ].RPN_POST_NMS_TOP_N
      layer_config["train_nms_thresh"] = float(
          cfg["TRAIN"].RPN_NMS_THRESH
      )
      layer_config["train_min_size"] = float(cfg["TRAIN"].RPN_MIN_SIZE)
  
      layer_config["test_pre_nms_topN"] = cfg["TEST"].RPN_PRE_NMS_TOP_N
      layer_config["test_post_nms_topN"] = cfg[
          "TEST"
      ].RPN_POST_NMS_TOP_N
      layer_config["test_nms_thresh"] = float(
          cfg["TEST"].RPN_NMS_THRESH
      )
      layer_config["test_min_size"] = float(cfg["TEST"].RPN_MIN_SIZE)
  
      if use_native_proposal_layer:
          cntk.ops.register_native_user_function(
              "ProposalLayerOp",
              "Cntk.ProposalLayerLib-" + cntk.__version__.rstrip("+"),
              "CreateProposalLayer",
          )
          rpn_rois_raw = ops.native_user_function(
              "ProposalLayerOp",
              [rpn_cls_prob_reshape, rpn_bbox_pred, im_info],
              layer_config,
              "native_proposal_layer",
          )
      else:
          rpn_rois_raw = user_function(
              ProposalLayer(
                  rpn_cls_prob_reshape,
                  rpn_bbox_pred,
                  im_info,
                  layer_config,
              )
          )
  
      return alias(rpn_rois_raw, name="rpn_rois")
  
file_path: CNTK/Examples/Image/Detection/utils/rpn/rpn_helpers.py
imports: import numpy
  import cntk
  from cntk import reduce_sum, ops
  from cntk import user_function, relu, softmax, slice, splice, reshape, element_times, plus, minus, alias, classification_error
  from cntk.initializer import glorot_uniform, normal
  from cntk.layers import Convolution
  from cntk.losses import cross_entropy_with_softmax
  from utils.rpn.anchor_target_layer import AnchorTargetLayer
  from utils.rpn.proposal_layer import ProposalLayer
  from utils.rpn.proposal_target_layer import ProposalTargetLayer
  from utils.rpn.cntk_smoothL1_loss import SmoothL1Loss
label_desc: Use image node_id 2 for calling a global function with example usage: create_proposal_layer(rpn_cls_prob_reshape, rpn_bbox_pred, im_info, cfg, use_native_proposal_layer) and returns: alias