code: def test_inference_object_detection_head_swin_backbone(self):
      model = DetaForObjectDetection.from_pretrained(
          "jozhang97/deta-swin-large"
      ).to(torch_device)
  
      image_processor = self.default_image_processor
      image = prepare_img()
      inputs = image_processor(images=image, return_tensors="pt").to(
          torch_device
      )
  
      with torch.no_grad():
          outputs = model(**inputs)
  
      expected_shape_logits = torch.Size(
          (1, 300, model.config.num_labels)
      )
      self.assertEqual(outputs.logits.shape, expected_shape_logits)
  
      expected_logits = torch.tensor(
          [
              [-7.6308, -2.8485, -5.3737],
              [-7.2037, -4.5505, -4.8027],
              [-7.2943, -4.2611, -4.6617],
          ]
      ).to(torch_device)
      expected_boxes = torch.tensor(
          [
              [0.4987, 0.4969, 0.9999],
              [0.2549, 0.5498, 0.4805],
              [0.5498, 0.2757, 0.0569],
          ]
      ).to(torch_device)
  
      self.assertTrue(
          torch.allclose(
              outputs.logits[0, :3, :3], expected_logits, atol=1e-4
          )
      )
  
      expected_shape_boxes = torch.Size((1, 300, 4))
      self.assertEqual(outputs.pred_boxes.shape, expected_shape_boxes)
      self.assertTrue(
          torch.allclose(
              outputs.pred_boxes[0, :3, :3], expected_boxes, atol=1e-4
          )
      )
  
      # verify postprocessing
      results = image_processor.post_process_object_detection(
          outputs, threshold=0.3, target_sizes=[image.size[::-1]]
      )[0]
      expected_scores = torch.tensor(
          [0.6831, 0.6826, 0.5684, 0.5464, 0.4392], device=torch_device
      )
      expected_labels = [17, 17, 75, 75, 63]
      expected_slice_boxes = torch.tensor(
          [345.8478, 23.6754, 639.8562, 372.8265], device=torch_device
      )
  
      self.assertTrue(
          torch.allclose(results["scores"], expected_scores, atol=1e-4)
      )
      self.assertSequenceEqual(
          results["labels"].tolist(), expected_labels
      )
      self.assertTrue(
          torch.allclose(results["boxes"][0, :], expected_slice_boxes)
      )
  
imports: import inspect
  import math
  import unittest
  from transformers import DetaConfig, ResNetConfig, is_torch_available, is_torchvision_available, is_vision_available
  from transformers.file_utils import cached_property
  from transformers.testing_utils import require_torchvision, require_vision, slow, torch_device
  from ...generation.test_utils import GenerationTesterMixin
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 3 for calling the DetaModelIntegrationTests obj's underlying member method code with example usage: obj.test_inference_object_detection_head_swin_backbone() without return types