(self, x, cond, mod)
| 114 | ) |
| 115 | |
| 116 | def forward(self, x, cond, mod): |
| 117 | # x: [N, L, D] |
| 118 | # cond: [N, L_cond, D_cond] |
| 119 | # mod: [N, D_mod] |
| 120 | x = x + self.cross_attn(self.norm1(x, mod), cond, cond, need_weights=False)[0] |
| 121 | before_sa = self.norm2(x, mod) |
| 122 | x = x + self.self_attn(before_sa, before_sa, before_sa, need_weights=False)[0] |
| 123 | x = x + self.mlp(self.norm3(x, mod)) |
| 124 | return x |