Method
__init__
(self,
img_size: int,
patch_size: int,
input_c: int,
output_c: int,
bias: bool = True,
dtype: trt.DataType = None)
Source from the content-addressed store, hash-verified
| 90 | class PatchEmbed(Module): |
| 91 | |
| 92 | def __init__(self, |
| 93 | img_size: int, |
| 94 | patch_size: int, |
| 95 | input_c: int, |
| 96 | output_c: int, |
| 97 | bias: bool = True, |
| 98 | dtype: trt.DataType = None): |
| 99 | super().__init__() |
| 100 | self.img_size = img_size |
| 101 | self.patch_size = patch_size |
| 102 | self.num_patches = (img_size // patch_size)**2 |
| 103 | self.proj = Conv2d(input_c, |
| 104 | output_c, |
| 105 | kernel_size=(patch_size, patch_size), |
| 106 | stride=(patch_size, patch_size), |
| 107 | bias=bias, |
| 108 | dtype=dtype) |
| 109 | |
| 110 | def forward(self, x): |
| 111 | assert x.shape[2] == self.img_size |
Callers
nothing calls this directly
Tested by
no test coverage detected