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

Method gaussian_topk

subprojects/llama.cpp/src/models/gemma3n-iswa.cpp:312–318  ·  view source on GitHub ↗

input x shape: [n_embd, n_tokens] output shape: [n_embd, n_tokens]

Source from the content-addressed store, hash-verified

310// input x shape: [n_embd, n_tokens]
311// output shape: [n_embd, n_tokens]
312ggml_tensor * llm_build_gemma3n_iswa::gaussian_topk(ggml_tensor * x) {
313 ggml_tensor * mean = ggml_mean(ctx0, x);
314 ggml_tensor * std = ggml_sqrt(ctx0, ggml_scale(ctx0, ggml_sum_rows(ctx0, ggml_sqr(ctx0, ggml_sub(ctx0, x, mean))),
315 1.0f / (float) (x->ne[0] - 1)));
316 ggml_tensor * cutoff_x = ggml_add(ctx0, mean, ggml_scale(ctx0, std, f_sparsity_std_mul));
317 return ggml_relu(ctx0, ggml_sub(ctx0, x, cutoff_x));
318}
319
320//
321// altup functions

Callers

nothing calls this directly

Calls 8

ggml_meanFunction · 0.85
ggml_sqrtFunction · 0.85
ggml_scaleFunction · 0.85
ggml_sum_rowsFunction · 0.85
ggml_sqrFunction · 0.85
ggml_subFunction · 0.85
ggml_addFunction · 0.85
ggml_reluFunction · 0.85

Tested by

no test coverage detected