origin
This commit is contained in:
27
digit_depth/train/mlp_model.py
Normal file
27
digit_depth/train/mlp_model.py
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
|
||||
|
||||
class MLP(nn.Module):
|
||||
dropout_p = 0.05
|
||||
|
||||
def __init__(
|
||||
self, input_size=5, output_size=3, hidden_size=32):
|
||||
super().__init__()
|
||||
|
||||
self.fc1 = nn.Linear(input_size, hidden_size)
|
||||
self.fc2 = nn.Linear(hidden_size, hidden_size)
|
||||
self.fc3 = nn.Linear(hidden_size, hidden_size)
|
||||
self.fc4 = nn.Linear(hidden_size, output_size)
|
||||
self.drop = nn.Dropout(p=self.dropout_p)
|
||||
|
||||
def forward(self, x):
|
||||
x = F.relu(self.fc1(x))
|
||||
x = self.drop(x)
|
||||
x = F.relu(self.fc2(x))
|
||||
x = self.drop(x)
|
||||
x = self.fc3(x)
|
||||
x = self.drop(x)
|
||||
x = self.fc4(x)
|
||||
return x
|
||||
Reference in New Issue
Block a user