fixed number of inputs

This commit is contained in:
Brian Bjarke Jensen
2024-07-28 21:13:51 +02:00
parent 396bf29f32
commit 6e9c0a2626
+4 -4
View File
@@ -1,14 +1,13 @@
from __future__ import annotations
import torch.nn as nn
class FullyConnectedModel(nn.Module):
"""Fully connected layers model template for intrepreting feature space-
output from ResNet18 head."""
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)
@@ -16,6 +15,7 @@ class FullyConnectedModel(nn.Module):
self.fc4 = nn.Linear(in_features=32, out_features=num_out_features)
def forward(self, x):
"""Pass input through model."""
x = self.fc1(x)
x = self.af1(x)
x = self.fc2(x)