code: def test_predict_boxes_tracing(self):
      class Model(torch.nn.Module):
          def __init__(self, output_layer):
              super(Model, self).__init__()
              self._output_layer = output_layer
  
          def forward(self, proposal_deltas, proposal_boxes):
              instances = Instances((10, 10))
              instances.proposal_boxes = Boxes(proposal_boxes)
              return self._output_layer.predict_boxes(
                  (None, proposal_deltas), [instances]
              )
  
      box_head_output_size = 8
  
      box_predictor = FastRCNNOutputLayers(
          ShapeSpec(channels=box_head_output_size),
          box2box_transform=Box2BoxTransform(weights=(10, 10, 5, 5)),
          num_classes=5,
      )
  
      model = Model(box_predictor)
  
      from detectron2.export.torchscript_patch import patch_builtin_len
  
      with torch.no_grad(), patch_builtin_len():
          func = torch.jit.trace(
              model, (torch.randn(10, 20), torch.randn(10, 4))
          )
  
          o = func(torch.randn(10, 20), torch.randn(10, 4))
          self.assertEqual(o[0].shape, (10, 20))
          o = func(torch.randn(5, 20), torch.randn(5, 4))
          self.assertEqual(o[0].shape, (5, 20))
          o = func(torch.randn(20, 20), torch.randn(20, 4))
          self.assertEqual(o[0].shape, (20, 20))
  
file_path: detectron2/tests/modeling/test_fast_rcnn.py
imports: import logging
  import unittest
  import torch
  from detectron2.layers import ShapeSpec
  from detectron2.modeling.box_regression import Box2BoxTransform, Box2BoxTransformRotated
  from detectron2.modeling.roi_heads.fast_rcnn import FastRCNNOutputLayers
  from detectron2.modeling.roi_heads.rotated_fast_rcnn import RotatedFastRCNNOutputLayers
  from detectron2.structures import Boxes, Instances, RotatedBoxes
  from detectron2.utils.events import EventStorage
label_desc: Use image node_id 5 for calling the FastRCNNTest obj's underlying member method code with example usage: obj.test_predict_boxes_tracing() and returns: self