class_docstr: Implements Region Proposal Network (RPN).
  
  Args:
      anchor_generator (AnchorGenerator): module that generates the anchors for a set of feature
          maps.
      head (nn.Module): module that computes the objectness and regression deltas
      fg_iou_thresh (float): minimum IoU between the anchor and the GT box so that they can be
          considered as positive during training of the RPN.
      bg_iou_thresh (float): maximum IoU between the anchor and the GT box so that they can be
          considered as negative during training of the RPN.
      batch_size_per_image (int): number of anchors that are sampled during training of the RPN
          for computing the loss
      positive_fraction (float): proportion of positive anchors in a mini-batch during training
          of the RPN
      pre_nms_top_n (Dict[str, int]): number of proposals to keep before applying NMS. It should
          contain two fields: training and testing, to allow for different values depending
          on training or evaluation
      post_nms_top_n (Dict[str, int]): number of proposals to keep after applying NMS. It should
          contain two fields: training and testing, to allow for different values depending
          on training or evaluation
      nms_thresh (float): NMS threshold used for postprocessing the RPN proposals
code: def pre_nms_top_n(self) -> int:
      if self.training:
          return self._pre_nms_top_n["training"]
      return self._pre_nms_top_n["testing"]
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
  from torchvision.ops import boxes, Conv2dNormActivation
  from .None import _utils
  from .anchor_utils import AnchorGenerator
  from .image_list import ImageList
label_desc: Use image node_id 2 for calling the RegionProposalNetwork obj's underlying member method code with example usage: obj.pre_nms_top_n() and returns: self, self