Download source/part2/utils/mlp.py from walke007/anlp-assignment2-part2: direct link, hf CLI and curl.
- Browser
- Download file 406 Bytes
-
https://huggingface.co/walke007/anlp-assignment2-part2/resolve/main/source/part2/utils/mlp.py
- Command line
-
hf download hf://walke007/anlp-assignment2-part2/source/part2/utils/mlp.py
-
curl -L -o mlp.py https://huggingface.co/walke007/anlp-assignment2-part2/resolve/main/source/part2/utils/mlp.py
406 Bytes
| import torch | |
| from torch import nn | |
| class FFN(nn.Module): | |
| def __init__(self, model_dimensions): | |
| super().__init__() | |
| self.d = model_dimensions | |
| self.FFN_stack = nn.Sequential( | |
| nn.Linear(self.d, 4 * self.d), | |
| nn.ReLU(), | |
| nn.Linear(4 * self.d, self.d) | |
| ) | |
| def forward(self, x): | |
| logits = self.FFN_stack(x) | |
| return logits | |