code: def test_fpn_carafe():
      # end_level=-1 is equal to end_level=3
      FPN_CARAFE(
          in_channels=[8, 16, 32, 64],
          out_channels=8,
          start_level=0,
          end_level=3,
          num_outs=4,
      )
      FPN_CARAFE(
          in_channels=[8, 16, 32, 64],
          out_channels=8,
          start_level=0,
          end_level=-1,
          num_outs=4,
      )
      # `end_level` is larger than len(in_channels) - 1
      with pytest.raises(AssertionError):
          FPN_CARAFE(
              in_channels=[8, 16, 32, 64],
              out_channels=8,
              start_level=1,
              end_level=4,
              num_outs=2,
          )
  
      # `num_outs` is not equal to end_level - start_level + 1
      with pytest.raises(AssertionError):
          FPN_CARAFE(
              in_channels=[8, 16, 32, 64],
              out_channels=8,
              start_level=1,
              end_level=2,
              num_outs=3,
          )
  
file_path: mmdetection/tests/test_models/test_necks/test_necks.py
imports: import pytest
  import torch
  from torch.nn.modules.batchnorm import _BatchNorm
  from mmdet.models.necks import FPG, FPN, FPN_CARAFE, NASFCOS_FPN, NASFPN, SSH, YOLOXPAFPN, ChannelMapper, DilatedEncoder, DyHead, SSDNeck, YOLOV3Neck
label_desc: Use image node_id 9 for calling a global function with example usage: test_fpn_carafe() without return types