Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The second parameter(300) is the number of dimension of your embedding model
- # padding_idx = 1: specify the <PAD>'s index is 1
- # max_norm = 1: If given, will renormalize the embeddings to always have a norm lesser than the given number
- embed = nn.Embedding(len(TEXT.vocab), 300, padding_idx=1, max_norm=1)
- # Copy the word vectors from dataset to nn.Embedding object
- embed.weight.data.copy_(TEXT.vocab.vectors)
Add Comment
Please, Sign In to add comment