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

Method build_pos_bias

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

Source from the content-addressed store, hash-verified

1573}
1574
1575ggml_tensor * llm_graph_context::build_pos_bias(ggml_tensor * pos_bucket, ggml_tensor * attn_rel_b) const {
1576 ggml_tensor * pos_bucket_1d = ggml_reshape_1d(ctx0, pos_bucket, pos_bucket->ne[0] * pos_bucket->ne[1]);
1577 cb(pos_bucket_1d, "pos_bucket_1d", -1);
1578
1579 ggml_tensor * pos_bias = ggml_get_rows(ctx0, attn_rel_b, pos_bucket_1d);
1580
1581 pos_bias = ggml_reshape_3d(ctx0, pos_bias, pos_bias->ne[0], pos_bucket->ne[0], pos_bucket->ne[1]);
1582 pos_bias = ggml_permute (ctx0, pos_bias, 2, 0, 1, 3);
1583 pos_bias = ggml_cont (ctx0, pos_bias);
1584
1585 cb(pos_bias, "pos_bias", -1);
1586
1587 return pos_bias;
1588}
1589
1590ggml_tensor * llm_graph_context::build_attn_mha(
1591 ggml_tensor * q,

Callers

nothing calls this directly

Calls 5

ggml_reshape_1dFunction · 0.85
ggml_get_rowsFunction · 0.85
ggml_reshape_3dFunction · 0.85
ggml_permuteFunction · 0.85
ggml_contFunction · 0.85

Tested by

no test coverage detected