code: def test_pvt():
      """Test PVT backbone."""
  
      with pytest.raises(TypeError):
          # Pretrained arg must be str or None.
          PyramidVisionTransformer(pretrained=123)
  
      # test pretrained image size
      with pytest.raises(AssertionError):
          PyramidVisionTransformer(pretrain_img_size=(224, 224, 224))
  
      # Test absolute position embedding
      temp = torch.randn((1, 3, 224, 224))
      model = PyramidVisionTransformer(
          pretrain_img_size=224, use_abs_pos_embed=True
      )
      model.init_weights()
      model(temp)
  
      # Test normal inference
      temp = torch.randn((1, 3, 32, 32))
      model = PyramidVisionTransformer()
      outs = model(temp)
      assert outs[0].shape == (1, 64, 8, 8)
      assert outs[1].shape == (1, 128, 4, 4)
      assert outs[2].shape == (1, 320, 2, 2)
      assert outs[3].shape == (1, 512, 1, 1)
  
      # Test abnormal inference size
      temp = torch.randn((1, 3, 33, 33))
      model = PyramidVisionTransformer()
      outs = model(temp)
      assert outs[0].shape == (1, 64, 8, 8)
      assert outs[1].shape == (1, 128, 4, 4)
      assert outs[2].shape == (1, 320, 2, 2)
      assert outs[3].shape == (1, 512, 1, 1)
  
      # Test abnormal inference size
      temp = torch.randn((1, 3, 112, 137))
      model = PyramidVisionTransformer()
      outs = model(temp)
      assert outs[0].shape == (1, 64, 28, 34)
      assert outs[1].shape == (1, 128, 14, 17)
      assert outs[2].shape == (1, 320, 7, 8)
      assert outs[3].shape == (1, 512, 3, 4)
  
imports: import pytest
  import torch
  from mmdet.models.backbones.pvt import PVTEncoderLayer, PyramidVisionTransformer, PyramidVisionTransformerV2
label_desc: Use image node_id 2 for calling a global function with example usage: test_pvt() without return types