MCPcopy Create free account
hub / github.com/pytorch/examples / forward

Method forward

distributed/tensor_parallelism/llama2_model.py:137–139  ·  view source on GitHub ↗
(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

135 return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
136
137 def forward(self, x: torch.Tensor):
138 output = self._norm(x.float()).type_as(x)
139 return output * self.weight
140
141 def reset_parameters(self):
142 torch.nn.init.ones_(self.weight) # type: ignore

Callers

nothing calls this directly

Calls 1

_normMethod · 0.95

Tested by

no test coverage detected