MCPcopy Index your code
hub / github.com/Turing-Project/WriteGPT / Classifier

Class Classifier

LanguageNetwork/BERT/models/encoder.py:10–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class Classifier(nn.Module):
11 def __init__(self, hidden_size):
12 super(Classifier, self).__init__()
13 self.linear1 = nn.Linear(hidden_size, 1)
14 self.sigmoid = nn.Sigmoid()
15
16 def forward(self, x, mask_cls):
17 h = self.linear1(x).squeeze(-1)
18 sent_scores = self.sigmoid(h) * mask_cls.float()
19 return sent_scores
20
21
22class PositionalEncoding(nn.Module):

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected