(self, x: torch.Tensor, conditioning_embedding: torch.Tensor)
| 176 | raise ValueError(f"unknown norm_type {norm_type}") |
| 177 | |
| 178 | def forward(self, x: torch.Tensor, conditioning_embedding: torch.Tensor) -> torch.Tensor: |
| 179 | emb = self.linear(self.silu(conditioning_embedding)) |
| 180 | scale, shift = torch.chunk(emb, 2, dim=1) |
| 181 | x = self.norm(x) * (1 + scale)[:, None, :] + shift[:, None, :] |
| 182 | return x |
| 183 | |
| 184 | |
| 185 | if is_torch_version(">=", "2.1.0"): |