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