(self, dim, single=False, dual=False)
| 68 | |
| 69 | class AdaLayerNorm(torch.nn.Module): |
| 70 | def __init__(self, dim, single=False, dual=False): |
| 71 | super().__init__() |
| 72 | self.single = single |
| 73 | self.dual = dual |
| 74 | self.linear = torch.nn.Linear(dim, dim * [[6, 2][single], 9][dual]) |
| 75 | self.norm = torch.nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) |
| 76 | |
| 77 | def forward(self, x, emb): |
| 78 | emb = self.linear(torch.nn.functional.silu(emb)) |