MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / patchify

Method patchify

Large-DiT-ImageNet/models.py:542–548  ·  view source on GitHub ↗
(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

540 return imgs
541
542 def patchify(self, x: torch.Tensor) -> torch.Tensor:
543 B, C, H, W = x.size()
544 assert (H, W) == (self.input_size, self.input_size)
545 pH = pW = self.patch_size
546 x = x.view(B, C, H // pH, pH, W // pW, pW)
547 x = x.permute(0, 2, 4, 1, 3, 5).flatten(-3).flatten(1, 2)
548 return x
549
550 def forward(self, x, t, y):
551 """

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected