def __init__(self,
                 cfgs,
                 channels,
                 embed_dims,
                 key_dims=[16, 24],
                 depths=[2, 2],
                 num_heads=8,
                 attn_ratios=2,
                 mlp_ratios=[2, 4],
                 drop_path_rate=0.1,
                 act_layer=nn.Sigmoid,
                 inj_type='AAM',
                 out_channels=256,
                 dims=(128, 160),
                 out_feat_chs=None,
                 stride_attention=True,
                 in_channels=3,
                 pretrained=None):
        """
        The StrideFormer implementation based on PaddlePaddle.

        The original article refers to:

        Args:
            cfgs(list): Each sublist describe the config for a MobileNetV3 block.
            channels(list): The input channels for each MobileNetV3 block.
            embed_dims(list): The channels of the features input to the sea attention block.  
            key_dims(list, optional): The embeding dims for each head in attention.
            depths(list, optional): describes the depth of the attention block. i,e: M,N.
            num_heads(int, optional): The number of heads of the attention blocks.
            attn_ratios(int, optional): The exapend ratio of V.
            mlp_ratios(list, optional): The ratio of mlp blocks.
            drop_path_rate(float, optional): The drop path rate in attention block.
            act_layer(nn.Layer, optional): The activation layer of AAM.
            inj_type(string, optional): The type of injection/AAM.
            out_channels(int, optional): The output channels of the AAM.
            dims(list, optional): The dimension of the fusion block.
            out_feat_chs(list, optional): The input channels of the AAM.
            stride_attention(bool, optioal): whether to stride attention in each attention layer.
            in_channels (int, optional): The channels of input image. Default: 3.
            pretrained(str, optional): the path of pretrained model.
        """
        super().__init__()
        self.depths = depths
        self.cfgs = cfgs
        self.dims = dims

        for i in range(len(cfgs)):
            smb = StackedMV3Block(
                cfgs=cfgs[i],
                stem=True if i == 0 else False,
                inp_channel=channels[i])
            setattr(self, f'smb{i+1}', smb)

        for i in range(len(depths)):
            dpr = [
                x.item() for x in paddle.linspace(0, drop_path_rate, depths[i])
            ]
            trans = BasicLayer(
                block_num=depths[i],
                embedding_dim=embed_dims[i],
                key_dim=key_dims[i],
                num_heads=num_heads,
                mlp_ratio=mlp_ratios[i],
                attn_ratio=attn_ratios,
                drop=0,
                attn_drop=0.0,
                drop_path=dpr,
                act_layer=act_layer,
                stride_attention=stride_attention)
            setattr(self, f"trans{i+1}", trans)

        self.inj_type = inj_type
        if self.inj_type == "AAM":
            self.inj_module = InjectionMultiSumallmultiallsum(
                in_channels=out_feat_chs, out_channels=out_channels)
            self.feat_channels = [out_channels, ]
        elif self.inj_type == "AAMSx8":
            self.inj_module = InjectionMultiSumallmultiallsumSimpx8(
                in_channels=out_feat_chs, out_channels=out_channels)
            self.feat_channels = [out_channels, ]
        elif self.inj_type == 'origin':
            for i in range(len(dims)):
                fuse = Fusion_block(
                    out_feat_chs[0] if i == 0 else dims[i - 1],
                    out_feat_chs[i + 1],
                    embed_dim=dims[i])
                setattr(self, f"fuse{i + 1}", fuse)
            self.feat_channels = [dims[i], ]
        else:
            raise NotImplementedError(self.inj_module + ' is not implemented')

        self.pretrained = pretrained
        self.init_weight()

        The StrideFormer implementation based on PaddlePaddle.

        The original article refers to:

        Args:
            cfgs(list): Each sublist describe the config for a MobileNetV3 block.
            channels(list): The input channels for each MobileNetV3 block.
            embed_dims(list): The channels of the features input to the sea attention block.  
            key_dims(list, optional): The embeding dims for each head in attention.
            depths(list, optional): describes the depth of the attention block. i,e: M,N.
            num_heads(int, optional): The number of heads of the attention blocks.
            attn_ratios(int, optional): The exapend ratio of V.
            mlp_ratios(list, optional): The ratio of mlp blocks.
            drop_path_rate(float, optional): The drop path rate in attention block.
            act_layer(nn.Layer, optional): The activation layer of AAM.
            inj_type(string, optional): The type of injection/AAM.
            out_channels(int, optional): The output channels of the AAM.
            dims(list, optional): The dimension of the fusion block.
            out_feat_chs(list, optional): The input channels of the AAM.
            stride_attention(bool, optioal): whether to stride attention in each attention layer.
            in_channels (int, optional): The channels of input image. Default: 3.
            pretrained(str, optional): the path of pretrained model.
        
paddleseg/models/backbones/strideformer.py