MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / forward

Method forward

PATH/core/models/backbones/vitdet.py:301–313  ·  view source on GitHub ↗
(self, x, mask=None, **kwargs)

Source from the content-addressed store, hash-verified

299 self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size)
300
301 def forward(self, x, mask=None, **kwargs):
302 # FIXME look at relaxing size constraints
303 # assert H == self.img_size[0] and W == self.img_size[1], \
304 # f"Input image size ({H}*{W}) doesn't match model ({self.img_size[0]}*{self.img_size[1]})."
305 x = self.proj(x)
306 Hp, Wp = x.shape[2], x.shape[3]
307
308 x = x.flatten(2).transpose(1, 2)
309
310 if mask is not None:
311 mask = F.interpolate(mask[None].float(), size=(Hp, Wp)).to(torch.bool)[0]
312
313 return x, (Hp, Wp), mask
314
315
316class Norm2d(nn.Module):

Callers

nothing calls this directly

Calls 1

toMethod · 0.45

Tested by

no test coverage detected