Update layernorm.py

This commit is contained in:
Daniel Han 2024-09-24 17:00:23 -07:00
commit 6801979ef3

View file

@ -178,7 +178,7 @@ def test_layernorm(
YY = torch.randn((bsz, seqlen, dim), dtype = dtype, device = "cuda", requires_grad = True)
Y.backward(YY)
correct_grad = X.grad.clone()
from unsloth.kernels import fast_layernorm
# from unsloth.kernels import fast_layernorm
Y = fast_layernorm(layernorm, XX)
Y.backward(YY)
assert(torch.dist(correct_grad, XX.grad).item() <= 0.1)