code: def test_resnet_fpn_backbone(backbone_name):
      x = torch.rand(1, 3, 300, 300, dtype=torch.float32, device="cpu")
      model = resnet_fpn_backbone(
          backbone_name=backbone_name, weights=None
      )
      assert isinstance(model, BackboneWithFPN)
      y = model(x)
      assert list(y.keys()) == ["0", "1", "2", "3", "pool"]
  
      with pytest.raises(
          ValueError, match=r"Trainable layers should be in the range"
      ):
          resnet_fpn_backbone(
              backbone_name=backbone_name,
              weights=None,
              trainable_layers=6,
          )
      with pytest.raises(
          ValueError,
          match=r"Each returned layer should be in the range",
      ):
          resnet_fpn_backbone(
              backbone_name=backbone_name,
              weights=None,
              returned_layers=[0, 1, 2, 3],
          )
      with pytest.raises(
          ValueError,
          match=r"Each returned layer should be in the range",
      ):
          resnet_fpn_backbone(
              backbone_name=backbone_name,
              weights=None,
              returned_layers=[2, 3, 4, 5],
          )
  
imports: import random
  from itertools import chain
  from typing import Mapping, Sequence
  import pytest
  import torch
  from common_utils import set_rng_seed
  from torchvision import models
  from torchvision.models._utils import IntermediateLayerGetter
  from torchvision.models.detection.backbone_utils import BackboneWithFPN, mobilenet_backbone, resnet_fpn_backbone
  from torchvision.models.feature_extraction import create_feature_extractor, get_graph_node_names
label_desc: Use image node_id 1 for calling a global function with example usage: test_resnet_fpn_backbone(backbone_name) without return types