code: def test_retina_shape(self, model, input_param, input_shape):
      backbone = model(**input_param)
      feature_extractor = resnet_fpn_feature_extractor(
          backbone=backbone,
          spatial_dims=input_param["spatial_dims"],
          pretrained_backbone=input_param["pretrained"],
          trainable_backbone_layers=None,
          returned_layers=[1, 2],
      )
      net = RetinaNet(
          spatial_dims=input_param["spatial_dims"],
          num_classes=input_param["num_classes"],
          num_anchors=num_anchors,
          feature_extractor=feature_extractor,
          size_divisible=32,
      ).to(device)
  
      with eval_mode(net):
          result = net.forward(torch.randn(input_shape).to(device))
  
          base_stride = (
              ensure_tuple(input_param["conv1_t_stride"])[0]
              if "conv1_t_stride" in input_param
              else 1
          )
          expected_cls_channel = (
              input_param["num_classes"] * num_anchors
          )
          expected_cls_shape = tuple(
              (input_shape[0], expected_cls_channel)
              + tuple(
                  input_shape[2 + a] // s // base_stride
                  for a in range(input_param["spatial_dims"])
              )
              for s in [2, 4, 8]
          )
          expected_box_channel = (
              2 * input_param["spatial_dims"] * num_anchors
          )
          expected_box_shape = tuple(
              (input_shape[0], expected_box_channel)
              + tuple(
                  input_shape[2 + a] // s // base_stride
                  for a in range(input_param["spatial_dims"])
              )
              for s in [2, 4, 8]
          )
  
          self.assertEqual(
              tuple(cc.shape for cc in result[net.cls_key]),
              expected_cls_shape,
          )
          self.assertEqual(
              tuple(cc.shape for cc in result[net.box_reg_key]),
              expected_box_shape,
          )
  
file_path: MONAI/tests/test_retinanet.py
imports: from __future__ import annotations
  import unittest
  import torch
  from parameterized import parameterized
  from monai.apps.detection.networks.retinanet_network import RetinaNet, resnet_fpn_feature_extractor
  from monai.networks import eval_mode
  from monai.networks.nets import resnet10, resnet18, resnet34, resnet50, resnet101, resnet152, resnet200
  from monai.utils import ensure_tuple, optional_import
  from tests.utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_onnx_save, test_script_save
label_desc: Use image node_id 1 for calling the TestRetinaNet obj's underlying member method code with example usage: obj.test_retina_shape(model, input_param, input_shape) without return types