Skip to content

Instantly share code, notes, and snippets.

@andreaschandra
Created July 11, 2019 13:34
Show Gist options
  • Save andreaschandra/692d0b0c9ae871501db7f1b69fab4f5c to your computer and use it in GitHub Desktop.
Save andreaschandra/692d0b0c9ae871501db7f1b69fab4f5c to your computer and use it in GitHub Desktop.
class Classifier(nn.Module):
def __init__(self):
super(Classifier, self).__init__()
self.NeurlNet = nn.Sequential(
nn.Linear(50, 40),
nn.ReLU(),
nn.Linear(40, 30),
nn.ReLU(),
nn.Linear(30, 1)
)
def forward(self, input_, apply_sigmoid=False):
x = self.NeurlNet(input_)
x = x.squeeze()
if apply_sigmoid:
x = torch.sigmoid(x)
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment