Skip to content

Instantly share code, notes, and snippets.

@Cj1m
Created February 26, 2021 12:48
Show Gist options
  • Save Cj1m/bb93dfc452235a5ace3d0b3c3d904f56 to your computer and use it in GitHub Desktop.
Save Cj1m/bb93dfc452235a5ace3d0b3c3d904f56 to your computer and use it in GitHub Desktop.
class NNSpectrogramModel(nn.Module):
def __init__(self):
super().__init__()
self.input_layer = 3968
h1 = 2645
h2 = 1024
encoding_size = 240
num_classes = 1
self.fc1 = nn.Linear(self.input_layer, encoding_size)
# self.fc2 = nn.Linear(h1, h2)
# self.fc3 = nn.Linear(h2, encoding_size)
self.fc4 = nn.Linear(encoding_size, num_classes)
self.sigmoid = nn.Sigmoid()
def forward(self, xb):
xb = xb.reshape(-1, self.input_layer)
out = self.encoding(xb)
out = self.fc4(out)
out = self.sigmoid(out)
return out
def encoding(self, xb):
out = self.fc1(xb)
out = self.sigmoid(out)
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment