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

Method __init__

tests/unit/modeling.py:275–281  ·  view source on GitHub ↗

Construct a layernorm module in the TF style (epsilon inside the square root).

(self, hidden_size, eps=1e-12)

Source from the content-addressed store, hash-verified

273 class BertLayerNorm(nn.Module):
274
275 def __init__(self, hidden_size, eps=1e-12):
276 """Construct a layernorm module in the TF style (epsilon inside the square root).
277 """
278 super(BertLayerNorm, self).__init__()
279 self.weight = nn.Parameter(torch.ones(hidden_size))
280 self.bias = nn.Parameter(torch.zeros(hidden_size))
281 self.variance_epsilon = eps
282
283 def forward(self, x):
284 u = x.mean(-1, keepdim=True)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected