MCPcopy Create free account
hub / github.com/andrewkchan/deepseek.cpp / rmsnorm

Function rmsnorm

src/infer.cpp:601–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601static void rmsnorm(float* o, float* x, float* weight, int size, float eps) {
602 float rms = 0.0f;
603 for (int i = 0; i < size; ++i) {
604 rms += x[i] * x[i];
605 }
606 rms = sqrtf(rms / size + eps);
607 float scale = 1.0f / rms;
608 for (int i = 0; i < size; ++i) {
609 o[i] = x[i] * scale * weight[i];
610 }
611}
612
613[[maybe_unused]] static void layernorm(float* o, float* x, float* weight, float* bias, int size, float eps) {
614 float mean = 0.0f;

Callers 3

_block_cpuMethod · 0.85
_attention_implMethod · 0.85
_forward_cpuMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected