MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / build_norm

Method build_norm

subprojects/llama.cpp/src/llama-graph.cpp:879–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877}
878
879ggml_tensor * llm_graph_context::build_norm(
880 ggml_tensor * cur,
881 ggml_tensor * mw,
882 ggml_tensor * mb,
883 llm_norm_type type,
884 int il) const {
885 switch (type) {
886 case LLM_NORM: cur = ggml_norm (ctx0, cur, hparams.f_norm_eps); break;
887 case LLM_NORM_RMS: cur = ggml_rms_norm(ctx0, cur, hparams.f_norm_rms_eps); break;
888 case LLM_NORM_GROUP:
889 {
890 cur = ggml_reshape_3d(ctx0, cur, cur->ne[0], 1, cur->ne[1]);
891 cur = ggml_group_norm(ctx0, cur, hparams.n_norm_groups, hparams.f_norm_group_eps);
892 cur = ggml_reshape_2d(ctx0, cur, cur->ne[0], cur->ne[2]);
893 } break;
894 }
895
896 if (mw || mb) {
897 cb(cur, "norm", il);
898 }
899
900 if (mw) {
901 cur = ggml_mul(ctx0, cur, mw);
902 if (mb) {
903 cb(cur, "norm_w", il);
904 }
905 }
906
907 if (mb) {
908 cur = ggml_add(ctx0, cur, mb);
909 }
910
911 return cur;
912}
913
914ggml_tensor * llm_graph_context::build_ffn(
915 ggml_tensor * cur,

Callers

nothing calls this directly

Calls 7

ggml_normFunction · 0.85
ggml_rms_normFunction · 0.85
ggml_reshape_3dFunction · 0.85
ggml_group_normFunction · 0.85
ggml_reshape_2dFunction · 0.85
ggml_mulFunction · 0.85
ggml_addFunction · 0.85

Tested by

no test coverage detected