mmseg/models/utils/self_attention_block.py
def build_project(self, in_channels, channels, num_convs, use_conv_module,
                      conv_cfg, norm_cfg, act_cfg):
        """Build projection layer for key/query/value/out."""
        if use_conv_module:
            convs = [
                ConvModule(
                    in_channels,
                    channels,
                    1,
                    conv_cfg=conv_cfg,
                    norm_cfg=norm_cfg,
                    act_cfg=act_cfg)
            ]
            for _ in range(num_convs - 1):
                convs.append(
                    ConvModule(
                        channels,
                        channels,
                        1,
                        conv_cfg=conv_cfg,
                        norm_cfg=norm_cfg,
                        act_cfg=act_cfg))
        else:
            convs = [nn.Conv2d(in_channels, channels, 1)]
            for _ in range(num_convs - 1):
                convs.append(nn.Conv2d(channels, channels, 1))
        if len(convs) > 1:
            convs = nn.Sequential(*convs)
        else:
            convs = convs[0]
        return convs
Build projection layer for key/query/value/out.
Build projection layer for key/query/value/out.
Build projection layer for key / query / value / out .
def build_project(self, in_channels, channels, num_convs, use_conv_module,
                      conv_cfg, norm_cfg, act_cfg):
        if use_conv_module:
            convs = [
                ConvModule(
                    in_channels,
                    channels,
                    1,
                    conv_cfg=conv_cfg,
                    norm_cfg=norm_cfg,
                    act_cfg=act_cfg)
            ]
            for _ in range(num_convs - 1):
                convs.append(
                    ConvModule(
                        channels,
                        channels,
                        1,
                        conv_cfg=conv_cfg,
                        norm_cfg=norm_cfg,
                        act_cfg=act_cfg))
        else:
            convs = [nn.Conv2d(in_channels, channels, 1)]
            for _ in range(num_convs - 1):
                convs.append(nn.Conv2d(channels, channels, 1))
        if len(convs) > 1:
            convs = nn.Sequential(*convs)
        else:
            convs = convs[0]
        return convs
def build_project ( self , in_channels , channels , num_convs , use_conv_module , conv_cfg , norm_cfg , act_cfg ) : if use_conv_module : convs = [ ConvModule ( in_channels , channels , 1 , conv_cfg = conv_cfg , norm_cfg = norm_cfg , act_cfg = act_cfg ) ] for _ in range ( num_convs - 1 ) : convs . append ( ConvModule ( channels , channels , 1 , conv_cfg = conv_cfg , norm_cfg = norm_cfg , act_cfg = act_cfg ) ) else : convs = [ nn . Conv2d ( in_channels , channels , 1 ) ] for _ in range ( num_convs - 1 ) : convs . append ( nn . Conv2d ( channels , channels , 1 ) ) if len ( convs ) > 1 : convs = nn . Sequential ( * convs ) else : convs = convs [ 0 ] return convs
Build projection layer for key/query/value/out.
Build projection layer for key / query / value / out .
"""Build projection layer for key/query/value/out."""
self
in_channels
channels
num_convs
use_conv_module
conv_cfg
norm_cfg
act_cfg