MCPcopy Create free account
hub / github.com/CompVis/zigma / PatchEmbed_Video

Class PatchEmbed_Video

model_zigma.py:66–78  ·  view source on GitHub ↗

2D Image to Patch Embedding

Source from the content-addressed store, hash-verified

64
65
66class PatchEmbed_Video(PatchEmbed):
67 """2D Image to Patch Embedding"""
68
69 def __init__(self, *args, **kwargs):
70 super().__init__(*args, **kwargs)
71
72 def forward(self, x):
73 B, T, C, H, W = x.shape
74 x = rearrange(x, "b t c h w -> (b t) c h w")
75 x = super().forward(x)
76 # (b t) n c
77 x = rearrange(x, "(b t) n c -> b (t n) c", t=T)
78 return x
79
80
81def exists(val):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected