MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / __init__

Method __init__

segmentation/backbones/mit.py:118–147  ·  view source on GitHub ↗
(self,
                 embed_dims,
                 num_heads,
                 attn_drop=0.,
                 proj_drop=0.,
                 dropout_layer=None,
                 init_cfg=None,
                 batch_first=True,
                 qkv_bias=False,
                 norm_cfg=dict(type='LN'),
                 sr_ratio=1)

Source from the content-addressed store, hash-verified

116 """
117
118 def __init__(self,
119 embed_dims,
120 num_heads,
121 attn_drop=0.,
122 proj_drop=0.,
123 dropout_layer=None,
124 init_cfg=None,
125 batch_first=True,
126 qkv_bias=False,
127 norm_cfg=dict(type='LN'),
128 sr_ratio=1):
129 super().__init__(
130 embed_dims,
131 num_heads,
132 attn_drop,
133 proj_drop,
134 dropout_layer=dropout_layer,
135 init_cfg=init_cfg,
136 batch_first=batch_first,
137 bias=qkv_bias)
138
139 self.sr_ratio = sr_ratio
140 if sr_ratio > 1:
141 self.sr = Conv2d(
142 in_channels=embed_dims,
143 out_channels=embed_dims,
144 kernel_size=sr_ratio,
145 stride=sr_ratio)
146 # The ret[0] of build_norm_layer is norm name.
147 self.norm = build_norm_layer(norm_cfg, embed_dims)[1]
148
149 def forward(self, x, hw_shape, identity=None):
150

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected