| 413 | |
| 414 | |
| 415 | class BertOutput(nn.Module): |
| 416 | |
| 417 | def __init__(self, config, weights, biases): |
| 418 | super(BertOutput, self).__init__() |
| 419 | self.dense = nn.Linear(config.intermediate_size, config.hidden_size) |
| 420 | self.dense.weight = weights[6] |
| 421 | self.dense.bias = biases[6] |
| 422 | self.LayerNorm = BertLayerNorm(config.hidden_size, eps=1e-12) |
| 423 | self.dropout = nn.Dropout(config.hidden_dropout_prob) |
| 424 | |
| 425 | def forward(self, hidden_states, input_tensor): |
| 426 | hidden_states = self.dense(hidden_states) |
| 427 | hidden_states = self.dropout(hidden_states) |
| 428 | hidden_states = self.LayerNorm(hidden_states + input_tensor) |
| 429 | return hidden_states |
| 430 | |
| 431 | |
| 432 | class BertLayer(nn.Module): |
no outgoing calls
no test coverage detected
searching dependent graphs…