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

Function ggml_argsort_top_k

subprojects/llama.cpp/ggml/src/ggml.c:5198–5212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5196// ggml_argsort_top_k
5197
5198struct ggml_tensor * ggml_argsort_top_k(
5199 struct ggml_context * ctx,
5200 struct ggml_tensor * a,
5201 int k) {
5202 GGML_ASSERT(a->ne[0] >= k);
5203
5204 struct ggml_tensor * result = ggml_argsort(ctx, a, GGML_SORT_ORDER_DESC);
5205
5206 result = ggml_view_4d(ctx, result,
5207 k, result->ne[1], result->ne[2], result->ne[3],
5208 result->nb[1], result->nb[2], result->nb[3],
5209 0);
5210
5211 return result;
5212}
5213
5214// ggml_top_k
5215

Callers 2

build_moe_ffnMethod · 0.85
build_graphMethod · 0.85

Calls 2

ggml_argsortFunction · 0.85
ggml_view_4dFunction · 0.85

Tested by 1

build_graphMethod · 0.68