Skip to content

Instantly share code, notes, and snippets.

@alonstern
Last active April 13, 2020 12:00
Show Gist options
  • Save alonstern/fc2a83b9bd54772b5d2e5de62b7ee559 to your computer and use it in GitHub Desktop.
Save alonstern/fc2a83b9bd54772b5d2e5de62b7ee559 to your computer and use it in GitHub Desktop.
embedding layer
class CNNModel(nn.Module):
def __init__(self, embedding_dim, vocab_size):
super().__init__()
self._word_embeddings = nn.Embedding(vocab_size, embedding_dim)
def forward(self, sample):
embeds = self._word_embeddings(sample)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment