code: def test_roiheads_inf_nan_data(self):
      self.model.eval()
      for tensor in [self._inf_tensor, self._nan_tensor]:
          images = ImageList(tensor(1, 3, 512, 512), [(510, 510)])
          features = {
              "p2": tensor(1, 256, 256, 256),
              "p3": tensor(1, 256, 128, 128),
              "p4": tensor(1, 256, 64, 64),
              "p5": tensor(1, 256, 32, 32),
              "p6": tensor(1, 256, 16, 16),
          }
          props = [Instances((510, 510))]
          props[0].proposal_boxes = Boxes([[10, 10, 20, 20]]).to(
              device=self.model.device
          )
          props[0].objectness_logits = torch.tensor([1.0]).reshape(1, 1)
          det, _ = self.model.roi_heads(images, features, props)
          self.assertEqual(len(det[0]), 0)
  
imports: import itertools
  import unittest
  from contextlib import contextmanager
  from copy import deepcopy
  import torch
  from detectron2.structures import BitMasks, Boxes, ImageList, Instances
  from detectron2.utils.events import EventStorage
  from detectron2.utils.testing import get_model_no_weights
label_desc: Use image node_id 2 for calling the MaskRCNNE2ETest obj's underlying member method code with example usage: obj.test_roiheads_inf_nan_data() without return types