MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / unpatchify

Method unpatchify

diffsynth/models/omnigen.py:413–423  ·  view source on GitHub ↗

x: (N, T, patch_size**2 * C) imgs: (N, H, W, C)

(self, x, h, w)

Source from the content-addressed store, hash-verified

411 nn.init.constant_(self.final_layer.linear.bias, 0)
412
413 def unpatchify(self, x, h, w):
414 """
415 x: (N, T, patch_size**2 * C)
416 imgs: (N, H, W, C)
417 """
418 c = self.out_channels
419
420 x = x.reshape(shape=(x.shape[0], h//self.patch_size, w//self.patch_size, self.patch_size, self.patch_size, c))
421 x = torch.einsum('nhwpqc->nchpwq', x)
422 imgs = x.reshape(shape=(x.shape[0], c, h, w))
423 return imgs
424
425
426 def cropped_pos_embed(self, height, width):

Callers 2

forwardMethod · 0.95
forwardMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected