(dim, mult=4)
| 5 | |
| 6 | # FFN |
| 7 | def FeedForward(dim, mult=4): |
| 8 | inner_dim = int(dim * mult) |
| 9 | return nn.Sequential( |
| 10 | nn.LayerNorm(dim), |
| 11 | nn.Linear(dim, inner_dim, bias=False), |
| 12 | nn.GELU(), |
| 13 | nn.Linear(inner_dim, dim, bias=False), |
| 14 | ) |
| 15 | |
| 16 | |
| 17 | def reshape_tensor(x, heads): |