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

Function ggml_set_rows

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

Source from the content-addressed store, hash-verified

3823// ggml_set_rows
3824
3825struct ggml_tensor * ggml_set_rows(
3826 struct ggml_context * ctx,
3827 struct ggml_tensor * a,
3828 struct ggml_tensor * b,
3829 struct ggml_tensor * c) {
3830 GGML_ASSERT(a->ne[0] == b->ne[0]);
3831 GGML_ASSERT(a->ne[2] == b->ne[2]);
3832 GGML_ASSERT(a->ne[3] == b->ne[3]);
3833 GGML_ASSERT(b->ne[1] == c->ne[0]);
3834 GGML_ASSERT(b->ne[2] % c->ne[1] == 0);
3835 GGML_ASSERT(b->ne[3] % c->ne[2] == 0);
3836 GGML_ASSERT(c->ne[3] == 1);
3837 GGML_ASSERT(b->type == GGML_TYPE_F32);
3838 GGML_ASSERT(c->type == GGML_TYPE_I64 || c->type == GGML_TYPE_I32);
3839
3840 GGML_ASSERT(ggml_is_contiguous_rows(a));
3841 GGML_ASSERT(ggml_is_contiguous_rows(b));
3842
3843 struct ggml_tensor * result = ggml_view_tensor(ctx, a);
3844
3845 result->op = GGML_OP_SET_ROWS;
3846 result->src[0] = b;
3847 result->src[1] = c;
3848 result->src[2] = a; // note: order is weird due to legacy reasons (https://github.com/ggml-org/llama.cpp/pull/16063#discussion_r2385795931)
3849
3850 return result;
3851}
3852
3853// ggml_diag
3854

Callers 8

build_moe_ffnMethod · 0.85
cpy_kMethod · 0.85
cpy_vMethod · 0.85
build_graphMethod · 0.85
build_graphMethod · 0.85
build_graphMethod · 0.85

Calls 2

ggml_is_contiguous_rowsFunction · 0.85
ggml_view_tensorFunction · 0.85

Tested by 3

build_graphMethod · 0.68
build_graphMethod · 0.68
build_graphMethod · 0.68