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

Method _norm

vtp/models/layers/normalization.py:17–18  ·  view source on GitHub ↗
(self, x: Tensor)

Source from the content-addressed store, hash-verified

15 nn.init.constant_(self.weight, 1)
16
17 def _norm(self, x: Tensor) -> Tensor:
18 return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
19
20 def forward(self, x: Tensor) -> Tensor:
21 output = self._norm(x.float()).type_as(x)

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected