fixed number of inputs
This commit is contained in:
@@ -1,14 +1,13 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
||||||
|
|
||||||
class FullyConnectedModel(nn.Module):
|
class FullyConnectedModel(nn.Module):
|
||||||
|
"""Fully connected layers model template for intrepreting feature space-
|
||||||
|
output from ResNet18 head."""
|
||||||
|
|
||||||
def __init__(self, num_out_features: int):
|
def __init__(self, num_out_features: int):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
# define layers
|
# 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.fc2 = nn.Linear(in_features=512, out_features=128)
|
||||||
self.af2 = nn.ReLU()
|
self.af2 = nn.ReLU()
|
||||||
self.fc3 = nn.Linear(in_features=128, out_features=32)
|
self.fc3 = nn.Linear(in_features=128, out_features=32)
|
||||||
@@ -16,6 +15,7 @@ class FullyConnectedModel(nn.Module):
|
|||||||
self.fc4 = nn.Linear(in_features=32, out_features=num_out_features)
|
self.fc4 = nn.Linear(in_features=32, out_features=num_out_features)
|
||||||
|
|
||||||
def forward(self, x):
|
def forward(self, x):
|
||||||
|
"""Pass input through model."""
|
||||||
x = self.fc1(x)
|
x = self.fc1(x)
|
||||||
x = self.af1(x)
|
x = self.af1(x)
|
||||||
x = self.fc2(x)
|
x = self.fc2(x)
|
||||||
|
|||||||
Reference in New Issue
Block a user