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