code: def test_detr_transformer_encoder_decoder():
      config = ConfigDict(
          num_layers=6,
          layer_cfg=dict(  # DetrTransformerDecoderLayer
              self_attn_cfg=dict(  # MultiheadAttention
                  embed_dims=256, num_heads=8, dropout=0.1
              ),
              cross_attn_cfg=dict(  # MultiheadAttention
                  embed_dims=256, num_heads=8, dropout=0.1
              ),
              ffn_cfg=dict(
                  embed_dims=256,
                  feedforward_channels=2048,
                  num_fcs=2,
                  ffn_drop=0.1,
                  act_cfg=dict(type="ReLU", inplace=True),
              ),
          ),
      )
      assert len(DetrTransformerDecoder(**config).layers) == 6
      assert DetrTransformerDecoder(**config)
  
      config = ConfigDict(
          dict(
              num_layers=6,
              layer_cfg=dict(  # DetrTransformerEncoderLayer
                  self_attn_cfg=dict(  # MultiheadAttention
                      embed_dims=256, num_heads=8, dropout=0.1
                  ),
                  ffn_cfg=dict(
                      embed_dims=256,
                      feedforward_channels=2048,
                      num_fcs=2,
                      ffn_drop=0.1,
                      act_cfg=dict(type="ReLU", inplace=True),
                  ),
              ),
          )
      )
      assert len(DetrTransformerEncoder(**config).layers) == 6
      assert DetrTransformerEncoder(**config)
  
file_path: mmdetection/tests/test_models/test_layers/test_transformer.py
imports: import pytest
  import torch
  from mmengine.config import ConfigDict
  from mmdet.models.layers.transformer import AdaptivePadding, DDQTransformerDecoder, DetrTransformerDecoder, DetrTransformerEncoder, PatchEmbed, PatchMerging
label_desc: Use image node_id 4 for calling a global function with example usage: test_detr_transformer_encoder_decoder() without return types