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

Function ggml_build_forward_impl

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

Source from the content-addressed store, hash-verified

6795}
6796
6797static void ggml_build_forward_impl(struct ggml_cgraph * cgraph, struct ggml_tensor * tensor, bool expand, bool compute) {
6798 if (!expand) {
6799 // TODO: this branch isn't accessible anymore, maybe move this to ggml_build_forward_expand
6800 ggml_graph_clear(cgraph);
6801 }
6802
6803 const int n_old = cgraph->n_nodes;
6804
6805 ggml_visit_parents_graph(cgraph, tensor, compute);
6806
6807 const int n_new = cgraph->n_nodes - n_old;
6808 GGML_PRINT_DEBUG("%s: visited %d new nodes\n", __func__, n_new);
6809
6810 if (n_new > 0) {
6811 // the last added node should always be starting point
6812 GGML_ASSERT(cgraph->nodes[cgraph->n_nodes - 1] == tensor);
6813 }
6814}
6815
6816struct ggml_tensor * ggml_build_forward_select(
6817 struct ggml_cgraph * cgraph,

Callers 2

Calls 2

ggml_graph_clearFunction · 0.85
ggml_visit_parents_graphFunction · 0.85

Tested by

no test coverage detected