code: def _test_rcnn_model(self, config_path):
      model = model_zoo.get(config_path, trained=True)
      model.eval()
  
      fields = {
          "proposal_boxes": Boxes,
          "objectness_logits": Tensor,
          "pred_boxes": Boxes,
          "scores": Tensor,
          "pred_classes": Tensor,
          "pred_masks": Tensor,
      }
      script_model = scripting_with_instances(model, fields)
      script_model = reload_script_model(script_model)
  
      # Test that batch inference with different shapes are supported
      image = get_sample_coco_image()
      small_image = nn.functional.interpolate(image, scale_factor=0.5)
      inputs = [{"image": image}, {"image": small_image}]
      with torch.no_grad():
          instance = model.inference(inputs, do_postprocess=False)[0]
          scripted_instance = script_model.inference(
              inputs, do_postprocess=False
          )[0]
      assert_instances_allclose(instance, scripted_instance)
  
imports: import copy
  import glob
  import json
  import os
  import random
  import tempfile
  import unittest
  import zipfile
  import torch
  from torch import Tensor, nn
  from detectron2 import model_zoo
  from detectron2.config import get_cfg
  from detectron2.config.instantiate import dump_dataclass, instantiate
  from detectron2.export import dump_torchscript_IR, scripting_with_instances
  from detectron2.export.flatten import TracingAdapter, flatten_to_tuple
  from detectron2.export.torchscript_patch import patch_builtin_len
  from detectron2.layers import ShapeSpec
  from detectron2.modeling import build_backbone
  from detectron2.modeling.postprocessing import detector_postprocess
  from detectron2.modeling.roi_heads import KRCNNConvDeconvUpsampleHead
  from detectron2.structures import Boxes, Instances
  from detectron2.utils.env import TORCH_VERSION
  from detectron2.utils.testing import assert_instances_allclose, convert_scripted_instances, get_sample_coco_image, random_boxes, reload_script_model, skipIfOnCPUCI
label_desc: Use image node_id 4 for calling the TestScripting obj's underlying member method code with example usage: obj._test_rcnn_model(config_path) without return types