MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / CausalConv3d

Class CausalConv3d

wan/modules/vae.py:17–36  ·  view source on GitHub ↗

Causal 3d convolusion.

Source from the content-addressed store, hash-verified

15
16
17class CausalConv3d(nn.Conv3d):
18 """
19 Causal 3d convolusion.
20 """
21
22 def __init__(self, *args, **kwargs):
23 super().__init__(*args, **kwargs)
24 self._padding = (self.padding[2], self.padding[2], self.padding[1],
25 self.padding[1], 2 * self.padding[0], 0)
26 self.padding = (0, 0, 0)
27
28 def forward(self, x, cache_x=None):
29 padding = list(self._padding)
30 if cache_x is not None and self._padding[4] > 0:
31 cache_x = cache_x.to(x.device)
32 x = torch.cat([cache_x, x], dim=2)
33 padding[4] -= cache_x.shape[2]
34 x = F.pad(x, padding)
35
36 return super().forward(x)
37
38
39class RMS_norm(nn.Module):

Callers 5

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected