原书出处
Natural Language Processing in Action, Second Edition
class Word2Vec(nn.Module): def __init__(self, vocab_size=len(vocab), embedding_size=EMBED_DIM): super().__init__() self.embed = nn.Embedding(vocab_size, embedding_size) #2 self.expand = nn.Linear(embedding_size, vocab_size, bias=False) def forward(self, input): hidden = self.embed(input) #3 logits = self.expand(hidden) #4 return logits #1 100 is small but usable for many problems, while 300 is more typical. #2 Initializes the layers of your network only once, when you instantiate the Word2Vec object #3 The hidden layer embeds (encodes)
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-6.html
EPUB SHA-256:0e9a35e49ca446e322e5524e53f39fb6bee5b2b23d9cda10ef052aca770b0b36