MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / llm_build_norm

Function llm_build_norm

llama.cpp:4420–4450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4418}
4419
4420static struct ggml_tensor * llm_build_norm(
4421 struct ggml_context * ctx,
4422 struct ggml_tensor * cur,
4423 const llama_hparams & hparams,
4424 struct ggml_tensor * mw,
4425 struct ggml_tensor * mb,
4426 llm_norm_type type,
4427 const llm_build_cb & cb,
4428 int il) {
4429 switch (type) {
4430 case LLM_NORM: cur = ggml_norm (ctx, cur, hparams.f_norm_eps); break;
4431 case LLM_NORM_RMS: cur = ggml_rms_norm(ctx, cur, hparams.f_norm_rms_eps); break;
4432 }
4433
4434 if (mw || mb) {
4435 cb(cur, "norm", il);
4436 }
4437
4438 if (mw) {
4439 cur = ggml_mul(ctx, cur, mw);
4440 if (mb) {
4441 cb(cur, "norm_w", il);
4442 }
4443 }
4444
4445 if (mb) {
4446 cur = ggml_add(ctx, cur, mb);
4447 }
4448
4449 return cur;
4450}
4451
4452static struct ggml_tensor * llm_build_ffn(
4453 struct ggml_context * ctx,

Callers 12

build_llama_variantsMethod · 0.85
build_optMethod · 0.85
build_baichuanMethod · 0.85
build_falconMethod · 0.85
build_starcoderMethod · 0.85
build_persimmonMethod · 0.85
build_refactMethod · 0.85
build_bloomMethod · 0.85
build_mptMethod · 0.85
build_stablelmMethod · 0.85
build_graphMethod · 0.85
build_graphMethod · 0.85

Calls 5

cbFunction · 0.85
ggml_normFunction · 0.70
ggml_rms_normFunction · 0.70
ggml_mulFunction · 0.70
ggml_addFunction · 0.70

Tested by 2

build_graphMethod · 0.68
build_graphMethod · 0.68