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

Method forward

chp5/cbow.py:49–55  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

47 init_weights(self)
48
49 def forward(self, inputs):
50 embeds = self.embeddings(inputs)
51 # 计算隐含层:对上下文词向量求平均
52 hidden = embeds.mean(dim=1)
53 output = self.output(hidden)
54 log_probs = F.log_softmax(output, dim=1)
55 return log_probs
56
57embedding_dim = 64
58context_size = 2

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected