27 lines
768 B
Python
27 lines
768 B
Python
from __future__ import annotations
|
|
|
|
import torch.nn as nn
|
|
|
|
|
|
class FullyConnectedModel(nn.Module):
|
|
def __init__(self, num_out_features: int):
|
|
super().__init__()
|
|
# define layers
|
|
self.fc1 = nn.Linear(in_features=16*16*512, out_features=512)
|
|
self.af1 = nn.ReLU()
|
|
self.fc2 = nn.Linear(in_features=512, out_features=128)
|
|
self.af2 = nn.ReLU()
|
|
self.fc3 = nn.Linear(in_features=128, out_features=32)
|
|
self.af3 = nn.ReLU()
|
|
self.fc4 = nn.Linear(in_features=32, out_features=num_out_features)
|
|
|
|
def forward(self, x):
|
|
x = self.fc1(x)
|
|
x = self.af1(x)
|
|
x = self.fc2(x)
|
|
x = self.af2(x)
|
|
x = self.fc3(x)
|
|
x = self.af3(x)
|
|
x = self.fc4(x)
|
|
return x
|