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

Method build_inp_cross_embd

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

Source from the content-addressed store, hash-verified

1519}
1520
1521ggml_tensor * llm_graph_context::build_inp_cross_embd() const {
1522 auto inp = std::make_unique<llm_graph_input_cross_embd>(cross);
1523
1524 auto & cur = inp->cross_embd;
1525
1526 // if we have the output embeddings from the encoder, use them directly
1527 // TODO: needs more work to be correct, for now just use the tensor shape
1528 //if (cross->t_embd) {
1529 // cur = ggml_view_tensor(ctx0, cross->t_embd);
1530
1531 // return cur;
1532 //}
1533
1534 const auto n_embd = !cross->v_embd.empty() ? cross->n_embd : hparams.n_embd_inp();
1535 const auto n_enc = !cross->v_embd.empty() ? cross->n_enc : hparams.n_ctx_train;
1536
1537 cur = ggml_new_tensor_2d(ctx0, GGML_TYPE_F32, n_embd, n_enc);
1538 ggml_set_input(cur);
1539
1540 res->add_input(std::move(inp));
1541
1542 return cur;
1543}
1544
1545ggml_tensor * llm_graph_context::build_inp_pos_bucket_enc() const {
1546 auto inp = std::make_unique<llm_graph_input_pos_bucket>(hparams);

Callers

nothing calls this directly

Calls 5

ggml_new_tensor_2dFunction · 0.85
ggml_set_inputFunction · 0.85
n_embd_inpMethod · 0.80
add_inputMethod · 0.80
emptyMethod · 0.65

Tested by

no test coverage detected