MCPcopy Create free account
hub / github.com/VCIP-RGBD/DFormer / __init__

Method __init__

mmseg/models/backbones/scnet.py:142–161  ·  view source on GitHub ↗
(self, dim, num_head=8, window=7, norm_cfg=dict(type="SyncBN", requires_grad=True))

Source from the content-addressed store, hash-verified

140
141class MemoryModulev2(nn.Module):
142 def __init__(self, dim, num_head=8, window=7, norm_cfg=dict(type="SyncBN", requires_grad=True)):
143 super().__init__()
144 self.num_head = num_head
145 self.window = window
146
147 self.q = nn.Linear(dim, dim)
148 self.a = nn.Linear(dim, dim)
149 self.l = nn.Linear(dim, dim)
150 self.conv = nn.Conv2d(dim, dim, 7, padding=3, groups=dim)
151
152 self.proj = nn.Linear(dim, dim)
153 if window != 0:
154 self.t = nn.Linear(dim, window * window * num_head)
155 self.conv_att = nn.Conv2d(dim, dim, 7, padding=3, groups=dim)
156 self.kv = nn.Linear(dim, dim * 2)
157 self.m = nn.Parameter(torch.zeros(1, window, window, dim), requires_grad=True)
158 self.proj = nn.Linear(dim * 2, dim)
159
160 self.act = nn.GELU()
161 self.norm = LayerNorm(dim, eps=1e-6, data_format="channels_last")
162
163 def forward(self, x):
164 B, H, W, C = x.size()

Callers

nothing calls this directly

Calls 2

LayerNormClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected