Store some hyper-parameters such as image size and patch size. seq_len = pre_len + image_len + post_len
| 22 | |
| 23 | |
| 24 | class 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 | |
| 40 | class ImagePatchEmbeddingMixin(BaseMixin): |
no outgoing calls
no test coverage detected