MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / rmsnorm_ref

Function rmsnorm_ref

reference.py:26–29  ·  view source on GitHub ↗

RMS normalization.

(x: torch.Tensor, weight: torch.Tensor, eps: float = 1e-6)

Source from the content-addressed store, hash-verified

24
25# RMS Normalization
26def rmsnorm_ref(x: torch.Tensor, weight: torch.Tensor, eps: float = 1e-6) -> torch.Tensor:
27 """RMS normalization."""
28 rms = torch.sqrt(torch.mean(x ** 2, dim=-1, keepdim=True) + eps)
29 return (x / rms) * weight
30
31# Flash Attention
32def flash_attention_ref(Q: torch.Tensor, K: torch.Tensor, V: torch.Tensor, causal: bool = True, sm_scale: float = None) -> torch.Tensor:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected