MCPcopy Create free account
hub / github.com/MiniMax-AI/VTP / LayerNorm

Class LayerNorm

vtp/models/layers/normalization.py:25–31  ·  view source on GitHub ↗

Subclass torch's LayerNorm (with cast back to input dtype).

Source from the content-addressed store, hash-verified

23
24
25class LayerNorm(nn.LayerNorm):
26 """Subclass torch's LayerNorm (with cast back to input dtype)."""
27
28 def forward(self, x: torch.Tensor):
29 orig_type = x.dtype
30 x = F.layer_norm(x, self.normalized_shape, self.weight, self.bias, self.eps)
31 return x.to(orig_type)
32
33
34class LayerNormFp32(nn.LayerNorm):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected