MCPcopy Create free account
hub / github.com/HIT-SCIR/plm-nlp-code / __init__

Method __init__

chp5/cbow.py:41–47  ·  view source on GitHub ↗
(self, vocab_size, embedding_dim)

Source from the content-addressed store, hash-verified

39
40class CbowModel(nn.Module):
41 def __init__(self, vocab_size, embedding_dim):
42 super(CbowModel, self).__init__()
43 # 词嵌入层
44 self.embeddings = nn.Embedding(vocab_size, embedding_dim)
45 # 线性变换:隐含层->输出层
46 self.output = nn.Linear(embedding_dim, vocab_size)
47 init_weights(self)
48
49 def forward(self, inputs):
50 embeds = self.embeddings(inputs)

Callers

nothing calls this directly

Calls 1

init_weightsFunction · 0.90

Tested by

no test coverage detected