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

Method __init__

PATH/core/models/backbones/vit.py:290–302  ·  view source on GitHub ↗
(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768, proj_padding=False)

Source from the content-addressed store, hash-verified

288 """
289
290 def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768, proj_padding=False):
291 super().__init__()
292 img_size = to_2tuple(img_size)
293 patch_size = to_2tuple(patch_size)
294 self.patch_shape = (img_size[0] // patch_size[0], img_size[1] // patch_size[1]) # could be dynamic
295 self.num_patches = self.patch_shape[0] * self.patch_shape[1] # could be dynamic
296 self.img_size = img_size
297 self.patch_size = patch_size
298
299 if proj_padding:
300 self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size, padding=2)
301 else:
302 self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size)
303
304 def forward(self, x, **kwargs):
305 B, C, H, W = x.shape

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected