You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mlp.py 421 B

4 years ago
1234567891011121314151617181920
  1. import torch.nn.functional as F
  2. import torch.nn as nn
  3. class MLP(nn.Module):
  4. def __init__(self):
  5. super(MLP, self).__init__()
  6. self.fc1 = nn.Linear(3072, 256)
  7. self.fc2 = nn.Linear(256, 256)
  8. self.fc3 = nn.Linear(256, 10)
  9. def forward(self, x):
  10. x = F.relu(self.fc1(x))
  11. x = F.relu(self.fc2(x))
  12. out = self.fc3(x)
  13. return out
  14. def mlp():
  15. return MLP()