Skip to content

Commit 4ab839f

Browse files
Michael Gschwindfacebook-github-bot
authored andcommitted
pow(n,2) => n*n
Summary: pow(n,2) => n*n Reviewed By: manuelcandales Differential Revision: D54142779 fbshipit-source-id: 91185e07e9fe040df090756d78be2cf5e87f6e1d
1 parent efa0e05 commit 4ab839f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/models/llama2/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _norm(self, x):
6262
torch.Tensor: The normalized tensor.
6363
6464
"""
65-
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
65+
return x * torch.rsqrt((x * x).mean(-1, keepdim=True) + self.eps)
6666

6767
def forward(self, x):
6868
"""

0 commit comments

Comments
 (0)