MCPcopy Create free account
hub / github.com/lingeringlight/START / __init__

Method __init__

models_mamba.py:43–54  ·  view source on GitHub ↗
(self, img_size=224, patch_size=16, stride=16, in_chans=3, embed_dim=768, norm_layer=None, flatten=True)

Source from the content-addressed store, hash-verified

41 """ 2D Image to Patch Embedding
42 """
43 def __init__(self, img_size=224, patch_size=16, stride=16, in_chans=3, embed_dim=768, norm_layer=None, flatten=True):
44 super().__init__()
45 img_size = to_2tuple(img_size)
46 patch_size = to_2tuple(patch_size)
47 self.img_size = img_size
48 self.patch_size = patch_size
49 self.grid_size = ((img_size[0] - patch_size[0]) // stride + 1, (img_size[1] - patch_size[1]) // stride + 1)
50 self.num_patches = self.grid_size[0] * self.grid_size[1]
51 self.flatten = flatten
52
53 self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=stride)
54 self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity()
55
56 def forward(self, x):
57 B, C, H, W = x.shape

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected