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

Method __init__

detection/backbone/vit_SelfPatch.py:119–126  ·  view source on GitHub ↗
(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768)

Source from the content-addressed store, hash-verified

117 """ Image to Patch Embedding
118 """
119 def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768):
120 super().__init__()
121 num_patches = (img_size // patch_size) * (img_size // patch_size)
122 self.img_size = img_size
123 self.patch_size = patch_size
124 self.num_patches = num_patches
125
126 self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size)
127
128 def forward(self, x):
129 B, C, H, W = x.shape

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected