code: def test_dyhead():
      s = 64
      in_channels = 8
      out_channels = 16
      feat_sizes = [s // 2**i for i in range(4)]  # [64, 32, 16, 8]
      feats = [
          torch.rand(1, in_channels, feat_sizes[i], feat_sizes[i])
          for i in range(len(feat_sizes))
      ]
      neck = DyHead(
          in_channels=in_channels,
          out_channels=out_channels,
          num_blocks=3,
      )
      outs = neck(feats)
      assert len(outs) == len(feats)
      for i in range(len(outs)):
          assert outs[i].shape[1] == out_channels
          assert outs[i].shape[2] == outs[i].shape[3] == s // (2**i)
  
      feat = torch.rand(1, 8, 4, 4)
      # input feat must be tuple or list
      with pytest.raises(AssertionError):
          neck(feat)
  
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 7 for calling a global function with example usage: test_dyhead() without return types