(self, dim, out_dim, patch_size, eps=1e-6)
| 320 | class Head(nn.Module): |
| 321 | |
| 322 | def __init__(self, dim, out_dim, patch_size, eps=1e-6): |
| 323 | super().__init__() |
| 324 | self.dim = dim |
| 325 | self.out_dim = out_dim |
| 326 | self.patch_size = patch_size |
| 327 | self.eps = eps |
| 328 | |
| 329 | # layers |
| 330 | out_dim = math.prod(patch_size) * out_dim |
| 331 | self.norm = WanLayerNorm(dim, eps) |
| 332 | self.head = nn.Linear(dim, out_dim) |
| 333 | |
| 334 | # modulation |
| 335 | self.modulation = nn.Parameter(torch.randn(1, 2, dim) / dim**0.5) |
| 336 | |
| 337 | def forward(self, x, e): |
| 338 | r""" |