Skip to content

Instantly share code, notes, and snippets.

@youben11
Created September 28, 2021 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youben11/e73814385a18c5e3e9a8e4581c23cb21 to your computer and use it in GitHub Desktop.
Save youben11/e73814385a18c5e3e9a8e4581c23cb21 to your computer and use it in GitHub Desktop.
HIDDEN_SIZE = 100
class Model(torch.nn.Module):
def __init__(self):
super().__init__()
self.lstm = torch.nn.LSTM(input_size=300, hidden_size=HIDDEN_SIZE)
self.fc = torch.nn.Linear(HIDDEN_SIZE, 1)
self.sigmoid = torch.nn.Sigmoid()
def forward(self, x):
_, (x, _) = self.lstm(x)
x = self.fc(x)
return self.sigmoid(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment