MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / forward

Method forward

lit_gpt/rmsnorm.py:834–838  ·  view source on GitHub ↗
(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

832 self.dim = dim
833
834 def forward(self, x: torch.Tensor) -> torch.Tensor:
835 # NOTE: the original RMSNorm paper implementation is not equivalent
836 norm_x = torch.mean(x * x, dim=self.dim, keepdim=True)
837 x_normed = x * torch.rsqrt(norm_x + self.eps)
838 return self.weight * x_normed
839
840 def reset_parameters(self):
841 torch.nn.init.ones_(self.weight)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected