code: def from_config(cls, cfg, input_shape: Dict[str, ShapeSpec]):
      ret = super(Caffe2Compatible, cls).from_config(cfg, input_shape)
      assert tuple(cfg.MODEL.RPN.BBOX_REG_WEIGHTS) == (
          1.0,
          1.0,
          1.0,
          1.0,
      ) or tuple(cfg.MODEL.RPN.BBOX_REG_WEIGHTS) == (
          1.0,
          1.0,
          1.0,
          1.0,
          1.0,
      )
      return ret
  
imports: import math
  from typing import Dict
  import torch
  import torch.nn.functional
  from detectron2.layers import ShapeSpec, cat
  from detectron2.layers.roi_align_rotated import ROIAlignRotated
  from detectron2.modeling import poolers
  from detectron2.modeling.proposal_generator import rpn
  from detectron2.modeling.roi_heads.mask_head import mask_rcnn_inference
  from detectron2.structures import Boxes, ImageList, Instances, Keypoints, RotatedBoxes
  from .shared import alias, to_device
label_desc: Use image node_id 1 for calling the Caffe2RPN obj's underlying member method code with example usage: obj.from_config(cls, cfg, input_shape) and returns: ret