MCPcopy
hub / github.com/deepspeedai/DeepSpeed / BertOutput

Class BertOutput

tests/unit/modeling.py:415–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413
414
415class 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
432class BertLayer(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…