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

Function ggml_argmax

ggml.c:3664–3683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3662// ggml_argmax
3663
3664struct ggml_tensor * ggml_argmax(
3665 struct ggml_context * ctx,
3666 struct ggml_tensor * a) {
3667 GGML_ASSERT(ggml_is_matrix(a));
3668 bool is_node = false;
3669
3670 if (a->grad) {
3671 GGML_ASSERT(false);
3672 is_node = true;
3673 }
3674
3675 int64_t ne[GGML_MAX_DIMS] = { a->ne[1], 1, 1, 1 };
3676 struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_I32, a->n_dims, ne);
3677
3678 result->op = GGML_OP_ARGMAX;
3679 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3680 result->src[0] = a;
3681
3682 return result;
3683}
3684
3685// ggml_repeat
3686

Callers 1

mainFunction · 0.50

Calls 3

ggml_is_matrixFunction · 0.70
ggml_new_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by 1

mainFunction · 0.40