class_docstr: The ROIHeads in a typical "C4" R-CNN model, where
  the box and mask head share the cropping and
  the per-region feature computation by a Res5 block.
  See :paper:`ResNet` Appendix A.
class_docstr_tok: ["The","ROIHeads","in","a","typical","``","C4","''","R-CNN","model",",","where","the","box","and","mask","head","share","the","cropping","and","the","per-region","feature","computation","by","a","Res5","block",".","See",":","paper",":","`","ResNet","`","Appendix","A","."]
docstr: Use the given boxes in `instances` to produce other (non-box) per-ROI outputs.
  
  Args:
      features: same as in `forward()`
      instances (list[Instances]): instances to predict other outputs. Expect the keys
          "pred_boxes" and "pred_classes" to exist.
  
  Returns:
      instances (Instances):
          the same `Instances` object, with extra
          fields such as `pred_masks` or `pred_keypoints`.
docstr_tok: ["Use","the","given","boxes","in","`","instances","`","to","produce","other","(","non-box",")","per-ROI","outputs",".","Args",":","features",":","same","as","in","`","forward","(",")","`","instances","(","list","[","Instances","]",")",":","instances","to","predict","other","outputs",".","Expect","the","keys","``","pred_boxes","''","and","``","pred_classes","''","to","exist",".","Returns",":","instances","(","Instances",")",":","the","same","`","Instances","`","object",",","with","extra","fields","such","as","`","pred_masks","`","or","`","pred_keypoints","`","."]
code: def forward_with_given_boxes(
      self,
      features: Dict[str, torch.Tensor],
      instances: List[Instances],
  ) -> List[Instances]:
      """
      Use the given boxes in `instances` to produce other (non-box) per-ROI outputs.
  
      Args:
          features: same as in `forward()`
          instances (list[Instances]): instances to predict other outputs. Expect the keys
              "pred_boxes" and "pred_classes" to exist.
  
      Returns:
          instances (Instances):
              the same `Instances` object, with extra
              fields such as `pred_masks` or `pred_keypoints`.
      """
      assert not self.training
      assert instances[0].has("pred_boxes") and instances[0].has(
          "pred_classes"
      )
  
      if self.mask_on:
          feature_list = [features[f] for f in self.in_features]
          x = self._shared_roi_transform(
              feature_list, [x.pred_boxes for x in instances]
          )
          return self.mask_head(x, instances)
      else:
          return instances
  
imports: import inspect
  import logging
  import numpy
  from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn
  from detectron2.config import configurable
  from detectron2.layers import ShapeSpec, nonzero_tuple
  from detectron2.structures import Boxes, ImageList, Instances, pairwise_iou
  from detectron2.utils.events import get_event_storage
  from detectron2.utils.registry import Registry
  from ..backbone.resnet import BottleneckBlock, ResNet
  from ..matcher import Matcher
  from ..poolers import ROIPooler
  from ..proposal_generator.proposal_utils import add_ground_truth_to_proposals
  from ..sampling import subsample_labels
  from .box_head import build_box_head
  from .fast_rcnn import FastRCNNOutputLayers
  from .keypoint_head import build_keypoint_head
  from .mask_head import build_mask_head
label_desc: Use image node_id 6 for calling the Res5ROIHeads obj's underlying member method code with example usage: obj.forward_with_given_boxes(features, instances) and returns: self, instances