MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / ViTProperty

Class ViTProperty

SwissArmyTransformer/sat/model/official/vit_model.py:24–37  ·  view source on GitHub ↗

Store some hyper-parameters such as image size and patch size. seq_len = pre_len + image_len + post_len

Source from the content-addressed store, hash-verified

22
23
24class ViTProperty:
25 """
26 Store some hyper-parameters such as image size and patch size.
27 seq_len = pre_len + image_len + post_len
28 """
29 def __init__(self, image_size, patch_size, pre_len, post_len, **kwargs):
30 assert isinstance(image_size, Iterable) and len(image_size) == 2
31 self.image_size = image_size
32 self.patch_size = patch_size
33 self.grid_size = (image_size[0] // patch_size, image_size[1] // patch_size)
34 self.num_patches = self.grid_size[0] * self.grid_size[1]
35 self.pre_len = pre_len
36 self.post_len = post_len
37 self.seq_len = self.pre_len + self.num_patches + self.post_len
38
39
40class ImagePatchEmbeddingMixin(BaseMixin):

Callers 4

init_functionFunction · 0.90
__init__Method · 0.90
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected